Build an iOS4 app that will also deploy on iPhone OS 3.x devices - iphone

I've got a couple of applications in the App Store at the moment which I've had ready after the release of iOS4. If I try and download one of these in the App store on a 3.x device, it will tell me I need to upgrade. Is there a way to make my application not do this, as I don't think I am using any API calls specific to iOS4.
I originally thought that this could not be done but I just now installed 'Plants vs Zombies' and 'Angry Birds' on my iPod Touch (running 3.1.3) so it must be possible as I'm sure these have released updates recently, and being in the top5 games, I would have thought they were developed using the iOS4 SDK. I am hoping it is just one value somewhere but if anyone could let me know how to do it that would be awesome :).

Easy. Open up your project info.
Find this line "iPhone OS Deployment Target" select 3.0
You can still develop with the latest xcode and current 4.0 SDK, but if you dont make any 4.0 calls this should allow you to weak link to 3.0+ and allow apps to work.
You really should test this on a 3.0+ device to see if it works though. You can still set your Base SDK to 3.2 or 4.0.

Related

How can I support both iOS 4.X SDK and iOS 5 SDK in my iPhone app?

I am writing an iPhone app in which I want to support the largest user base possible at this point in time (with minimal pain), so I decided that targeting IOS 4.3+ would be a good subset of users for my audience.
I started working in XCode 4.2, but reverted back to XCode 4.1 when I realized that the project templates had changed and everything seemed very intertwined with storyboarding, ARC, etc.
I have built out my application to the point I actually want to test on my device, which has iOS5 installed. When I attempt to use it though, I get this message as soon as I click 'use for development' in Organizer/XCode:
The project's build settings look like this:
My Question Is This: How do I get this application, built in XCode 4.1, to run on both iOS 4.3 and iOS 5 phones?
Are iOS SDKs not backward compatible? I come from Android development in which a less than current SDK will generally work on a newer SDK - is this different in the iOS world? And if so, how is this handled typically?
Any direction on how I should proceed would be greatly appreciated.
You can go ahead and open your app in Xcode 4.2 and it should still work. I've been working on a particular app since Xcode 3.x days and I'm nearly done, chugging along in Xcode 4.2 right now. It shouldn't be a problem. If you want to work with Xcode 4.1 you will be fine, but you won't be ale to use new features introduced in iOS 5.
There are several aspects of "cross-version" development to note.
Testing: You can only test on version of iOS that are included with your SDK, or that are installed on physical devices that you may have. The SDK generally comes only with the latest iOS, sometimes the previous one is included as well, but since Xcode 4 was released, the older SDKs have been progressively deprecated with each release. This is not to say that your app which is linked against the iOS 5 SDK won't run on older versions of iOS. It just depends on how you implement new features.
Features: In order to support older versions of iOS properly, you want to make sure that you don't implement new features without properly checking for the existence of classes, methods, and properties that were introduced in the newer versions of the OS. Unlike Android, you don't have to worry about a million hardware configurations. ;-)
Weak Linking: To support a new feature and still be compatible with older versions of iOS, you need to weak link against frameworks that you are using to implement new features. You can read more about that in the Apple Documentation on Weak Linking.
Deployment Target: The setting that prevents the app from loading on older devices is called the "Deployment Target". If you set this to 3.1.3, then your app will run on iOS 3.1.3 and higher. Remember that if you don't code the the proper version checking, your app may break.
ARC: You can choose to enable or disable Automatic Reference Counting when you create the project. ARC scans your program at compile time only, not at runtime, it doesn't break the app on older versions of the OS.
You need the latest version of XCode and the iOS SDK to install your apps onto your iOS 5.0 phone. That doesn't mean the inverse is true -- you don't need the same version of iOS on your device that you have installed on your computer.
Hope this helps!
You can use the latest SDK and simply set the "IOS Deployment Target" version to 4.3 in the project build settings.
XCode 4.1 doesn't support iOS5 in the sense that Xcode package doesn't contain the iOS5 SDK. So you must return to Xcode 4.2 and target your project for iOS 4.3 (you can also target it for iOS 4.0 with this Xcode version, but you will not be able to simulate it; you can even download older iOS 4.x package versions from the Xcode preferences menu if you really need to simulate them in your device).
You can opt-out of ARC if you want, this choice is given to you when you create the project, so don't worry; but consider that ARC does its magic at compile time only, not at runtime, so your backward compatibility will be kept if you decide to use this technology. Finally if you don't want Storyboard just pick the Empty app template and it will simply put in your project only the basic files. From this template you can create any iOS app, this is the approach I normally follow.

I am using Xcode 3.2.5. I have iAds running. Confused about about targest, iOs versions

Trying to keep up with the curve. I'm reading almost too much and is sending me in a tail spin. Is there a one stop link which will tell me what my target should be to run my app on all platforms based on what frameworks I have included? I make heavy use of Mapkit, and want to include iAds. My current apps seem dead on 3G.
Does Apple force you to support only the latest iOS? I have no problem with that, but not sure if someone who has and ancient 3G, how do I tell them, NO I don't support your phone, please upgrade?
Set your project's base SDK to the latest version of the SDK. Set the deployment target to the oldest version of the OS that you plan to support. You can use features introduced in versions later than your deployment target, but you'll need to check for them before you use them, else your app will crash.
Read the release notes for each version of the OS to get a good idea of what features were introduced when. In fact, make it a habit to read the release notes thoroughly each time a new version comes out.
iOS 4.2 runs pretty well on an iPhone 3G, so there's no need to drop support for the 3G anytime soon. If your apps currently don't work on the 3G, fire up your debugger and figure out why. What version of iOS are you running on that device? Where does it crash? This is typical debugging stuff.

iPhone App Run Different iOS

I am getting a fat binary when I go to upload, and I want to make sure that my application can run across 3.0, well even 2.0. Is there a specific way to make sure that this will show when I go to upload. I am not using any specific iOS 4 features, and I only have iOS 4 in my xCode. How can I test different iOS version?
The only way as I could think of is test your app on real old OS version devices. Since Apple prefers its users to upgrade to new OS version as soon as possible, they don't actually provide an official way for developers to test such backward compatibility.
Another relevant questions would be, "can I downgrade my device OS version to an old one, so that I can test my app on them?" I once did a research on SO and other Apple forums, and the result I got was NO, we developers don't have a way to "officially" downgrade our device OS version. Yes there are exceptions, you can try jail-breaking and then downgrading.
For jail-breaking / downgrading your OS version, check this post, A TimeMachine taking my iDevice back to 3.1.2? .
Edited: It's actually pretty easy to make sure that users with old OS versions can downloaded and install your app. All you need to do is set the Deployment Target in Xcode to the lowest OS version you want (iOS 3.0 would be the lowest in Xcode 3.2.5).
However, you need to bear in mind that such Deployment Target only ensures that your app can be downloaded and installed on such old version OS devices. They don't ensure compatibility during runtime. You still need to test your app on real old OS devices to ensure compatibility.
I dont think u need to worry about app version 3.0 below because it is not supported anymore. but how to test on different version, make sure change the iOS deployment target as Thomas refered.
There is no currently supported way to do this.
No current Simulator or Xcode tool will ensure that an app is completely compatible with an OS version older than the SDK used. The 2.0 SDK is not compatible with the current development tools. There is no officially supported way to downgrade a device.
Furthermore, Apple no longer even accepts app submissions that have a deployment target lower than 3.0.
Even most old 1st gen devices, if you can find one on eBay, have been upgraded to iOS 3.1.3. But if you have access to an old device running iOS 3.1.3, you can use that for testing. Many developers keep an old used iPod Touch around for just his purpose.
People with devices running something older than 3.1.3 are not only a really tiny percentage of the installed base, but are very unlikely to be still buying apps for that device. Even large developers with staff and legacy hardware available for this testing rarely waste the time on this market.
Look into Project -> Edit Project Settings -> iOS Deployment Target: 3.13. And then build?
Edit according to comment: You still need to ENSURE your code is within the runtime scope, i.e. do checks like 'respondstoselector' before calling methods in question.

Publishing iPhone app that supports iOS 3.1 plus

We are about to issue version 4.0 of our iPhone app and have had some complaints recently that previous versions are only available from iOS 4.1 plus. I know that to change this I can set my Deployment Target (In Project>Build) to iOS 3.1. However, I've run through the app on an emulator and again on my iPhone (uses iOS 4.2) but I'm not able to test on anything older as everyone here has the same iOS or 4.3. Can I safely assume that just by changing the Deployment Target and testing the app on later models that the app will run safely on later versions like 3.1.
We are familiar with the reason why people with older iPhones wont upgrade to iOS 4.0 and above, so we would like to accomodate them but not if it means the app is unsound and we have no way of testing it.
No, just because it compiles and runs on newer version of the SDK does not mean that it will work on older versions. If you're using features that are only available in iOS 4+ you'll need to check for their existence before using them; your app will crash otherwise.
There are some subtleties that you'll probably miss the first time too (or at least I did). In short, there's no real alternative to testing.
for the problem you have you need to install older versions of xcode having ios 3.0 support and you need to check whether it's working on the same or not as there are lots many changes in os 4.0 and above so it's definite that the application will not work with the ios 3.0, 3.1 available device and it will crashed.
Just install older version of SDK and test on simulator , if works then fine else you need to make code according to ios version 3.0 and ios version 4.0 in your code by differentiating the os and run the code accordingly.

Developing for 2.2.1 SDK on Snow Leopard

I’ve installed Snow Leopard, have Xcode 3.2 and 3.0 iPhone SDK. I want my applications to run on 2.2.1, but the SDK is nowhere to be found in Xcode. I’ve set the deploy target to 2.2.1, but still I cannot be sure I am not using any 3.0-isms. (I’ve sent a sample application to my friend who still has 2.2.1 and it does not run, so it looks I really do use some 3.0 specific API.) How can make sure that my applications will run on 2.2.1? (Simulator also lists only 3.0 as version option.) I’d hate to check my sources manually for every call that might not have existed in 2.2.1.
See my question.
However, I think this is a bad situation that Apple has created for us. There really is no way to test against 2.x.x, if you, like me, have no iPhone 2.2s to test against. I actually bought a new 3Gs just so I could use the old 3G for testing. Stupidly though, when iTunes came up one day and asked if I wanted my phone updated to 3.0.1, I said yes, without realizing which phone I was updating.
I have tried, to no avail, to downgrade to 2.2.1, doing all the things like holding the home button and power for 10 seconds, etc., but I keep getting a baseband loading error.
I know Apple is trying hard to push everyone to 3.0, but not having the stats on how many users are still on the older OS, it seems prudent to keep supporting that OS. They should at least have kept 2.2.x support for the Simulator. I hate to release a 2.2.1 app based on whether I think I am using 3.0 calls or not, without actually testing it on 2.2.1.
OK, SDK 3.1 was released yesterday (September 9) and also contains SDK 2.2.1. You cannot build for the Simulator, only for the device, but most of the glaring 3.0-isms will appear as compile errors, which makes testing much easier.
Uninstall the SDK or Developer folder completley.
using Terminal execute: /Library/uninstall-devtools --mode=all, then restart, re-install new SDK.