Discussion Forums  >  Config Data, JSON, App Refresh

Replies: 6    Views: 123

mutzy
Aspiring developer
Profile
Posts: 841
Reg: Nov 03, 2010
Medford, MA
9,860
04/29/13 06:16 PM (11 years ago)

Separate config file for iPhone and iPad... possible?

How would I go about setting up my app to use a different config.txt file depending if it was iPhone vs iPad? The reason for this is that there are some screens in the iPhone version I don't want to have in the iPad version. Josh
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
04/29/13 06:47 PM (11 years ago)
There is some logic in the app_delegate that you could "hijack", or you could add your own logic. It gets a little confusing depending on if you're compiling an "offline" or "online" app, but in can be done either way. Sorry for the vague answer, but I'll be happy to help you out more when I know a little more. I'm working on some similar logic options for my App Transformer plugin. -Chris
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
04/29/13 07:12 PM (11 years ago)
Well, it's a cheat. and you'd have to do it on all screens (present and future). In the 'viewDidLoad' method, you can always add: if([appDelegate.rootApp.rootDevice isIPad]) { // code to hide, or display different stuff } else { // code to show on an iPhone } Just a thought. Nipping it at the bud as Chris describes would probably be 'best' if you can do it. But if it's not 'too' many screens, you can do a quick/dirty cheat. Cheers! -- Smug
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
04/30/13 02:02 AM (11 years ago)
I think it would be easiest to set a switch from the CP to be able to control the screens. This would need a bit of logic as Smug has said. I'll probably be able to get to that hopefully by next week. Actually I had roamed into that area before but rather than an iPad/iPhone differentiation I wanted to differentiate Android/iOS Config files. Then I saw it might be better to create two apps altogether.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/30/13 05:49 AM (11 years ago)
@Webneeves - I have a new menu plugin coming out that will let you differentiate between Android and iOS for menu items. @mutzy - Stobe is on target here. You'll want to hack up the appDelegate file. You'll also need a place to store the alternative config file.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
04/30/13 07:10 AM (11 years ago)
Is it still standard practice to have separate iPhone and iPad apps? Or is that tacky now and folks just expect universal? @webneeves - if you're self hosting - separate apps for different platforms is what I suggest. Single App concept is great but just not practical when you want to take advantage of one platforms functionality. look how difficult just to have different layouts/screens on the same platform....
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
04/30/13 10:56 AM (11 years ago)
@ATRAIN53 - Thanks, yes I did that just as I started to self host. And that was mainly because of the layout differences between iOS and Android. Of course now that I have different plugins for each it is really a necessity. But the urge to separate was really felt before self hosting... @Chris - Neat. will keep in mind while waiting for it.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.