iAd and iphone before 4g compatibility - iphone

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.

Related

iOS app downgrade compatibility requirements

I was wondering if it's possible to downgrade an app from the app store (ARM binary) to a lower version. For example if the app requires iOS 5.0 or 4.3 or later getting it to run on iOS 4.2 or 4.0.
I understand that the requirements are important as the newer version contains API linked calls only exposed on the newer iOS platform. However, I've many apps that are cabable of running on lower versions are needlessly compiled on newer versions of xcode (just a minor update supports a huge jump on iOS supported version, like iOs 4.0 -> iOs 5.0)
What I would like to do is maybe downgrade an iOS 5.0 app to iOS 4.3 app by verifying that there are no new linked functions apis and thereby adjusting the plist files to the lower vesion? Can otool or class-dump help with this?
Yes, it's possible. Submit a binary with a different "iOS Deployment Target" (in Project > Info and Targets > Deployment Target), even if it is lower than the one you currently have.
You'll need to do extensive testing to make sure your code runs on the various compatible iOS, since a lot has changed with the release of iOS 5 (and subsequently, 6), meaning a lot of functions and methods will not be recognized in those iOS versions.
Regarding finding which API's may not work, here's a small discussion of [Finding unsupported API's with OS version][1]
[1]: finding unsupported apis with os version "Finding unsupported API's with OS version".

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.

What sdk version of iPhone app should I use? 4.2 or 3.?

Should I be developing my app for 4.2?
Always use the latest SDK. Apple won't approve any apps built against 3.x anymore.
Edit:
There's a difference between the base SDK and the iOS you plan to support. You need to use the latest SDK as I stated before, however you may still create an app that runs on older versions of iOS by not using classes and methods that have been introduced in newer releases and setting the target OS appropriately.
Unless you have the need to support older iOS devices with older iOS versions, you should develop using 4.2 as it has a lot of features that are missing in 3.x. Most importantly: 3.x doesn't support multitasking.
Also, it's important to understand the relationship between Base SDK version and deployment target. In a nutshell: you can (and should) compile against the latest SDK version but if done correctly, you can still run the app on older iOS versions.
The base SDK should always be the latest version available (4.2 as of right now). Then you can use the deployment target to specify the minimum OS that your application will support, so a good rule of the thumb would be to use 3.0 for that.
Personally, I use some of new iOS 4.0 stuff (ie. GCD) a lot in my applications. I've heard that 90% of ios users are on 4.x. That should be a good middle ground.

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.

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

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).