Hiding already developed iPad classes in iPhone app - iphone

For development reasons, I started developing a universal iOS app, but want to launch with the iPhone version only first.
Besides modifying the “Targeted Device Family” to “iPhone” in the build settings, are there any more necessary steps to prevent users opening the already developed iPad classes/views on their iPad?
Moreover, is there a possibility for users (e.g. with jailbroken devices) to enter the app in iPad mode on their iPad? (How) Can this be prevented?

You can put a condition like :
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
--- do something--
}
and comment out the calls for loading iPad classes and views

The answer to this varies based on how you've set up your existing code. If for example, you perform run time checks for the current hardware E.g if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) and change the UI based on the result of this, then you'll have to redo some code because even if the app only has an interface for iPhones, that condition would still evaluate true on an iPad.
Then another option is to have your classes split between interfaces. This is probably the best method when done right. By that I mean really sticking to the MVC paradigm and making your two interfaces separately, then linking each to its own controller object and then putting as much reusable logic for your app in one universally accessible object somewhere.
If you're done this the second way I've mentioned, you shouldn't have any trouble. Simply by pointing the project toward a storyboard for the iPhone/iPad versions of the project, the correct class files are loaded etc. Which leads me to the direct answer to your question.
Modifying the "Targeted Device Family” is all you really have to do provided you've set up your project in the second way I listed. And furthermore, there shouldn't be any concern that jailbroken users will access the iPad files. They can get in, but they're all compiled anyway and 99% of people don't know what to do with that big blob of gibberish.
And even if they did, I don't think anyone is going out of their way to try to find iPad versions of iPhone only apps. They know that if an app has a completed iPad version, it will just run on their iPad.

you do not need something else besides modifying "Targeted Device Family" property. I see little possibility that launching iPad mode is possible even on jailbreaked devices, but you can, for example, remove iPad files (and dependencies for them) from your project for iPhone build. I still think this is not necessary step.

Related

iphone Ipad application UI development strategy

I am beginner and plan to make a Iphone/Ipad application which will receive a questionary xml from restful webservice, parse it, get answers from user..with two buttons(next, back) on screen, as you may guess there will be validation alert messages, display messages..etc..checkboxes, radiobuttons, date pickers depend on questions type.
So what would be the best strategy, to insert if else blocks on user interface and choose the layout for device type while I am developing the application, or first make a working iphone version and convert it to Ipad later on, and would that be easier? what kind of problems should I expect while converting to IPAD..thanks!
When you create a universal app, you have the option to keep all viewControllers and xib files separate for iPhone and iPad. This is very handy. Alternately, you can check which device the user has and load the correct xib that way, but since the structure of the apps may be quite different, I strongly encourage the latter approach instead.
The ipad has a bigger screen. This is numerous consequences for designing most apps. Also, the ipad has a splitviewcontroller which is quite handy, whereas the iphone tabbarcontroller is better there.
iPhone and iPad have different UI requirements. Read the apple iOS human interface guidelines, it's very nicely explained in there. You'll also find the answer of what to do if you usually would use radio buttons, because there are no radio buttons on iOS.

Is there a global way to merge an iPhone and an iPad app into a universal app?

I wrote an iPhone app. Then, I changed the interface a fair bit, added higher res images, and made an iPad version of it. In a perfect world, I would like for anyone who buys the iPad version to get the iPhone version for free (though not conversely). Since Apple doesn't seem to have a way to do that (right??), my next favorite solution is to make the iPad version include the iPhone version somehow.
I know that I could just convert the iPad version to "universal", but since the face of the app is so different, that seems like a real pain. I have many view controllers and they are almost completely different between the two versions. Some of the methods are the same, but only about 30%. Is there an easy solution along the lines of this:
Check if device is iPhone or iPad
If iPhone, then use one group of files
If iPad, then use a different group of files
Thanks in advance!
Try creating a new project in Xcode and choose to make it a universal app. In the default way Xcode lays it out, there is a distinct divide between the iPad and iPhone versions. You can make the two versions of the app as similar or different as you want.
In addition, you can check which device you are running on at runtime by using UI_USER_INTERFACE_IDIOM(). Currently the two values for this are UIUserInterfaceIdiomPad and UIUserInterfaceIdiomPhone.
The "easy solution" you describe is basically how iOS loads Universal apps.
There's no other real way around it. You'll have to merge your two projects into one again to do what you want.
The first problem will be that some (many?) names of classes will be common between both projects. You can save yourself some pain by using the "Refactor..." functionality in Xcode to change the names of the classes in one project (say, your iPhone app, since it's older) before you merge them together. The second problem will be your Info.plist; you'll need to ensure that the correct "Main nib file base name", the correct supported interface orientations, icon files, and so on are set to correct values for both iPad and iPhone respectively.

iOS - iphone/ipad versioning

I currently have an iphone app that I want to make an ipad version of. I don't want it to be "universal" though. I want to sell the ipad version for a different price than the iphone version.
My question - what is the best way to go about this in Xcode? Do I just copy the project and then maintain two separate projects, and do the ipad build from the new project? Seems this is the only way to go, but will be a pain to make updates to both. Suggestions? Advice? Thanks.
In almost the same way that you would make an app universal, you can make a separate iPad version. Disclaimer: I haven't actually done this before, I went the universal route. Now what you need to do is first right click on your target and click "Upgrade Current Target for iPad..." Then click "Two device-specific applications" and "OK." Good luck.
I went through something similar with my apps. I had a working iPhone version of an app that I wanted to port to the iPad. I created an iPad-specific project and added the share-able code to this. Fortunately for me, I had a pretty clean separation of the data and UI code and was able to share most of the data code; in the new iPad project, the only thing I had to write new code for was the UI stuff.
I'm totally open to changing the way I handle this separation. In theory, it would seem that you could specify different bundle identifiers and turn on/off settings to enable iPad or iPhone versions. But I had decided that it'd just be simpler to separate out my iPad/iPhone projects.
Hope this helps!
Instead of using two projects, add an iPad app target to your iPhone project. This way, whenever you change shared code, it is updated for both apps.

UIFileSharingEnabled has no effect

I've added UIFileSharingEnabled to the .plist. Per suggestions, I have:
removed the app and redeployed it several times
attempted to disconnect after redeploying
I have not been able to get the app visible in the File Sharing section in iTunes. On another app, this works flawlessly. The app where it doesn't work has a bit exotic internals (an easily portable game; as such, it has its own mainloop, it doesn't have a main nib, ...). The app where it does work is pretty much standard deal. Also, testing was done on two different devices: it worked on iPod Touch 4 with iOS 4.2.1, but it didn't work on iPhone 3GS with iOS 4.2.1.
Since it's a bit difficult to isolate the problem (and I could probably spend several MORE hours isolating it), is there any other known requirement to get file sharing to work?
CFBundleDisplayName is additionally required in the .plist. Why Apple elected to require this, I have no idea.

iPhone, app release, change device requirements

I have released an app in the appstore months ago.
It was first made only for iPhone (because I wanted to do so), now I would like to release it also for the iPod Touch.
What I have to do to make the iphone app available to ipod touch too?
When I update the app (new version tested on the ipod) I cannot change the value of the dropdown labeled "Device Requirements"
I don't want to make another app with the same content and same code just to change that value!
Many thanks
I would contact Apple Developer Support and tell them you would like the change. In many cases, they can override things like this.
This is weird. Anyway, besides contacting the support, bear in mind that you also need to modify your -info.plist file adding the "Required device capabilities" (UIRequiredDeviceCapabilities) key.
Basically, you define here what kind of hardware your application uses, such as wifi, core location, compass, accelerometer etc. This is then used to automatically distinguish a device capable of running your app from another which is not.
This is not yet mandatory, but Apple will warn you if you submit an application targeting the iPhone and iPod Touch 2nd generation without a properly configured plist file.
I've come to a solution releasing an update of the app.