How can I test my iPhone app on earlier than SDK 3.0 simulator, make sure it work? - iphone

I wrote iPhone application. Very simple! It use Cocos2D only, and all other features is very basic, no accelerometer, no camera, nothing. Just buttons and sounds.
I think every iPhone can run this app (there is no limits on Cocos2D right?), but my XCode only let me use 3.0 and upwards. I want to confirm 1 thing and ask one thing:
If I put "iPhone OS 2.0" in my iPhone OS Deployment Target in XCode, but my "Active SDK" in XCode still says 3.0, if I compile using this and submit to App Store, when it goes up, people who use 2.0 can still download and use the game yes?
Is there way I can test in a 2.0 simulator to make sure it works? My XCode only have 3.0 and higher simulation.

Set your Deployment Target for iPhone OS 2.0 and Base SDK for whatever version of the SDK you have (3.0, 3.1.2, 3.1.3, 3.2, etc.). Active SDK is just a compile-time override of the Base SDK. You should set your Base SDK to the latest STABLE version of the SDK and the Deployment to the oldest device you intend to support.
If you open up the iPhone Simulator and select from the menu bar Hardware > Version, you should see an option for SDK version 2.x. If you don't see this, you don't have any 2.0 SDK versions installed. 2.2.1 was included up to version 3.1.3, but you might not see it in the Simulator. You'll have to find an older version of the SDK to install. They can be found online by Googling. Don't have a link off-hand, but shouldn't be hard.
Edit
This is out-of-date for the newest version of Xcode (currently 3.2.5).

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.

iOS Development: How can I run my iPhone 4.2 app on the iPhone 3.2 simulator?

I'm diving into iOS development and I'm building a simple app that will support iOS version 3.2 to 4.2. I've tested it fairly well in the latest version of Xcode on the 4.2 simulator, but I would like to also simulate it running on a iOS 3.2 device. After reading a few tutorials on this, I managed to download and install an older version of xcode along with the older 3.2 SDK, but when I build my project in the older version of Xcode, I get a ton errors due surrounding all the iOS 4.2 functionality that the older version of Xcode doesn't support. I'm weak-linking all the 4.2 frameworks, but I'm still getting errors. How can I get my 4.2 app to build successfully in this older version of Xcode and get it to run in the 3.2 iPhone simulator?
Thanks so much for your wisdom!
You need to add #ifdef __IPHONE_4_2...#endif around any lines that reference features that only exist on 4.2. That way the 3.2 compiler will build your app as if those lines don't exist.
You need to be extremely careful to structure these statements in such a way that they exactly mirror the bits of code that would be disabled when running the built-for-4.2 build on 3.2, otherwise there's not a lot of point.
This will build your app without any of the 4.2 functionality included, so it isn't actually testing whether your weak-linking etc is correct, it's just testing how the fallback 3.2 code works.
It will probably throw up a few warnings about features/methods you didn't know didn't exist in 3.2. Make sure these have appropriate fallback code added.
(btw Apple has been known to reject iPhone apps with a Base SDK of 3.2. You need to support at least 3.1.3 if you go back before 4.0)
Did you select the option of setting the base SDK to 3.0 or others?Because by doing so you can run the new APIs available in iOS 4.2 on older OS also.
Cheers
On the second issue, of actually running it in a 3.2 version of the iPhone within the iOS simulator: I've struggled with this -- Xcode 4.0.2, set my deployment target to iOS 3.2, set my project to iPhone only, but when I try to run in the iOS Simulator under version 3.2, the simulator morphs into the iPad simulator, even if it had been running as an iPhone simulator until I selected the version number.
This frustrated me for a while. But I read this and it made sense:
http://en.wikipedia.org/wiki/IOS_version_history
The iPhone never ran 3.2; that was an iPad-only release. So, even though the Hardware > Version menu in the iOS Simulator lists 3.2 (7W367A), presumably that setting is only intended to be compatible with Hardware > Device > iPad. The simulator is enforcing this rule when it switches me into an iPad simulator. It makes complete sense.
So I'd need a 3.1.3 simulator, or older, to run my app as if running on a 3.x-generation iPhone. This isn't available in my Xcode 4 build, so it makes sense to me now that I'm just unable to do anything about this, short of putting older Xcode builds on my machine.
I think the right way to do is as follows:
1.If you are developing for version 4.2, then you must be having Xcode version 4.2 installed.
2.While building your application on devices 4.0 and 3.2 OS, select base SDK to 4.2, and deployment target device to the minimum version you want to support, say 3.2. This will make your code compatible to lower version and your application will be loaded on lower versions.
Also to support new APIs in lower versions you may follow the link :
http://www.marco.org/1648550153
I hope this helps you
You can run both 3.2 and 4.x simulators in the latest Xcode (not at the same time, of course!). You have to set "Base SDK" to 4.2 and "iOS Deployment Target" to 3.2. Now you can select the 3.2 Simulator (or later) from the "Overview" popup menu in the top left corner of the project window. Also you can select the simulator version in the iOS Simulator app itself, via the "Hardware->Version" menu item.

compiling iphone 3.1.3 with XCode 3.2.3?

I just downloaded XCode 3.2.3 with iphone sdk 4, but I need to compile my app with 3.1.3, but there is no option in the project settings for that (just 4.0 or 3.2). Is there any other possibility for me besides downgrading to XCode 3.2.2??
In the Deployment section of the Build settings, there is an option to set iPhone OS Deployment Target. You can choose 3.1.3 from the list of available OS versions.
Yes, you may choose any iPhone OS
Deployment target from the list. But
make sure that you are not using any
iPhone SDK 4.0 specific
methods/properties.
That is the catch, isn't it... is there an easy way to check that we're not doing any iOS4 SDK calls if we cant trap it during a compile?
I found this (see the bottom of the page):
http://0xced.blogspot.com/2010/07/using-sdk-313-with-iphone-sdk-4.html
Unfortunately, it requires the following on the first step:
"Locate iPhoneOS3.1.3.sdk and iPhoneSimulator3.1.3.sdk from an iPhone SDK 3 installation"
And, of course I blew away my iPhone SDK 3 installation when I installed the iOS 4 SDK. So I'm kinda stuck.
Is there another alternative?
Thanks!
Yes, you may choose any iPhone OS Deployment target from the list. But make sure that you are not using any iPhone SDK 4.0 specific methods/properties.
I strongly recommend you read this. SDKs other than 3.2 and 4.0 are no longer available for App Store submission.

iAd and iphone before 4g compatibility

iAd seems to require iphone os 4.0, so I install the new beta ver xcode and sdk.
It works.
But The previous sdk disappear.
Now, the new build app (with iAd) is also retro compatible with 3.1.x? Or with iAd I have to renounce to retro compatibility?
You should use the standard method of building a single binary which can take advantage of features available in newer OS versions only, but still run on older OS versions too: build the application with Base SDK set to 4.0, and the Deployment Target to a lower OS version, for example 3.0. The frameworks available only in the newer OS versions should be weakly linked and the application should then check at runtime which features are available (iAd for example) and act accordingly.
See Apple's on example on how to do this: http://developer.apple.com/iphone/library/samplecode/MailComposer/Introduction/Intro.html.
iAd doesn't work with previous version (before 4.0)
I found a solution in adwhirl.
So I put inside my app adwhirl. I put admob, adsense or other circuit and iad.
I weak link in xcode project the iad framework, and adwhirl understand if iad is supported, so if ok iad appear else other circuit work!
When xCode 3.2.3 is officially released you will be able to build to previous versions again, however iAd will probably not compile on pre 4.0 builds.

Base versus Active versus Deployment target

I know that parts of this question was asked in several variation but I want to make sure I got it right.
Here are my assumptions and understandings which I want to know if they are correct before submitting.
My application assumes features supported by all OS, and so I should:
Set the Active SDK to be the latest (currently SDK 3.0).
Set the Deployment Target to be the lower I want to be supported - iPhone 2.0 and higher?
What exactly is the Base SDK for? should I ignore it if I chose Active SDK to be different and where do I see the Active SDK in the Projects settings?
One final question - is apple allowing to choose iPhone OS 2.0 as the Deployment Target?
Thanks in advance,
BTW - one of my main reason for this question is because when compiling with earlier SDKs apple seems to have a problem releasing the memory for UIImageView animation array when this animation was saved for multiple time usage. This is a known problem that was fixed with SDK 3.0 (by simply setting the UIImageView animation array to nil)
The difference between the Base and Active SDK is that the former is the default SDK set for the project and the latter is the SDK you are currently building against. So it is possible for your Active SDK to be the Base SDK, at which point XCode will use the SDK you specified for the project.
In order to build your app for the widest set of devices possible, you are correct:
Set the Base SDK to the lastest SDK possible (3.0, 3.0.1)
Set the Deployment Target to the earliest SDK possible (2.0)
Apple does allow you to specify iPhone 2.0 as the Deployment Target, but keep in mind any API or framework released after iPhone 2.0 you will not have available to you for use by default. There are techniques to use features from later SDKs, however they are nontrivial.
You should set the Base SDK build setting to the latest SDK that contains all of the features that you intend to use (usually, the latest available SDK), and set the "iPhone Deployment Target" build setting to the earliest version of the OS on which you want to run.
You then need to make sure that you check, at runtime, for any features that may not exist on the earlier OSes.
"Base SDK" is the Maximum SDK you application can support. There's a hard limit here - you can't select a future, unreleased SDK.
"Deployment Target" is the Minimum SDK you are willing to support. It how far back in time you are willing to go.
Xcode appear to create a spurious dependency on "Deployment Target." For example, I can't develop on my iOS 5.1.1 iPod with Xcode 4.5.2 (Xcode 4.5.2 is paired with iOS 6.0), even though the 4.3, 5.0, and 5.1 APIs and Simulators are installed on this installation. I need to use the simulator or jack in my iOS 6.0 iPhone.
The games Apple is playing appears to be causing problems with apps, too. My purchased copy of Elements will not sync via iTunes to the iPod because Elements needs a newer version of iOS to run (it syncs and runs fine on my iOS 6.0 iPhone).
I've got two iPads and one is 4.3. I shudder to think what a mess it will cause.
In general;
Set the BASE SDK to the very latest SDK you are willing to support and test.
Set the Deployment Target to the lowest version of iOS you are willing to support and test.
If you happen to use Base SDK features not available on the deployment target SDK, the app will crash at runtime on older devices, so testing is vital.
An alternative / complementary process would be to use Deploymate http://www.deploymateapp.com/ which does static code analysis to identify problems.
If you are from the android world the analogies are such;
TargetSDK -> Base SDK
MinSDK -> Deployment Target
Lint -> Deploymate