I have an app on the store which was built for 3.1.2, but which was crashing under 4.0GM. I've fixed the crash problem using Xcode 3.2.3, but was also getting warnings that such-and-such class did not implement NSXMLParserDelegate. I added to the headers and everything seemed fine. I've now submitted the app and it's waiting for review. This latest version was compiled with base SDK of 4.0, and a deployment target of 3.1.2.
The problem I have is that this morning I opened up the project in Xcode 3.2.2, and when building against base SDK of 3.1.2, I'm getting compile errors saying that NSXMLParserDelegate does not exist. Does this mean my app that is waiting for review is going to crash under 3.1.2 devices? This is strange, because my beta testers who are using 3.1.3 and I think 3.1.2, said the app works fine. Shouldn't it crash if it can't compile against base SDK of 3.1.2?
I think this should be ok to discuss in regards to the 4.0 NDA, as my problem is specific to 3.1.X.
First of all, the NDA has been lifted this week, so no problem to discuss the iOS 4.0 SDK.
As for your question: there's a difference between compiling and running an application.
The NSXMLParserDelegate protocol was added in the iOS4 SDK. In previous versions of the SDK, the XML parser delegate methods were declared in a category. In iOS4, these methods have been moved to a dedicated protocol, which makes it a litte cleaner. At runtime, there's no difference. Once compiled, the app doesn't know anything about protocols or categories. The NSXMLParser will simply check if a specific delegate method is implemented (via respondsToSelctor), so it will run just fine.
In general, it's not a problem to build with iOS4 SDK and run on 3.0. You do have to make sure you don't call any methods that don't exist in 3.0. This is very easy to do by calling respondsToSelector. It allows you to create a single app that runs on all OS versions, but still allows you to call 4.0-specific methods.
I hope this makes sense ...
Related
New here guys but have got a genuine problem. I have an iPhone app that was developed using SDK4. With apple introducing the new iOS version 6, does my code need to be recompiled on the new SDK to make it compatible with version 6?
Right now it crashes on iOS6. Also, do I need to do that everytime apple brings out a new version? I wonder every other app on earth already does that ?!
The problem with major iOS upgrades is method deprecation. It may happen that some parts of your code relies on methods that are not supported in iOS6. When this happens you should first check for API changes then recompile it with the latest API. If your code base works fine with iOS6 than there is no need for recompiling it, but unfortunately that doesn't seems to be your case.
Sometimes you don't need too. Most of the time, Apple publishes updates for libraries, so sometimes the old code is not compatible anymore. You have to recompile it, or you'll find issues.
For example I had a working app on iOS 5. With the iOS 6 update, I had to refer some code new because the app crashed with SIGABRT. Before iOS 6 it was working fine. Through Xcode's Debugger, most of the time finding issues is not hard work.
I've found that most of the time a crash will be caused by an existing bug in my application that I wasn't aware of. Subtle changes revealed it. It is rarely just a question of recompiling, but of fixing that bug.
Just recompiling can be dangerous. Apple can (and does) detect what version of the development tools your app was compiled with, maintains some behaviour that will keep your app running. Update, and you'll get the new behaviour instead.
I didn't have to recompile mine just for the sake of IOS6. They worked fine. But I had to adjust for 4" iphone 5 screen.
I wrote a code on IOS SDK 4.0 and tried running on a device which contains IOS 4.2. I am seeing a empty navigation view. What changes in my code I should do to run it on the target version of SDK.
It's very hard to say without having more information on the project and what technologies within iOS it makes use of. Is there anything in the release notes that sheds light on your problem:
http://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-4_2/
Might be worth checking 4.1 ones as well:
http://developer.apple.com/library/ios/#releasenotes/General/RN-iPhoneSDK-4_1/
So, I may have made a mistake in updating my application to iOS 4.0 by wiping my Xcode installation and only installing the 4.0 SDK (I can't even find SDK 3.1.3 in my backups, doh!). I have an app now that has been built with a base SDK of 4.0 and it says in iTunes it requires 4.0 but the only thing I added was the methods -applicationDidEnterBackgroundState and -applicationDidBecomeActive (basically just copied and pasted the save/load data code from -applicationWillTerminate and -viewDidLoad). Is it possible that I can rebuild the app with the iPhone OS Deployment Target set to 3.1.3 in the Build Settings and Apple will allow me to essentially downgrade my app? Should I put in those #If_Define statements that check for 4.0 so it will conditionally enable those 4.0 methods?
No, you shouldn't need to use #ifdef statements. You can call a method anything you want - the question is whether or not the UIApplication instance will call it :).
Also, your deployment settings will handle the iTunes issue, I believe. So, you should set it to 3.1.3 (or 3.0 unless specifically required, a lot of people I know didn't upgrade between the 3s because there were minimal features and many times it was essentially an anti-jailbreak release).
As for the code, I've handled this issue like this:
- (void) applicationWillTerminate:(UIApplication *)application
{
// Just pass it on to the new iOS4 delegate
NSLog(#"Application will terminate");
[self applicationDidEnterBackground:application];
}
And for the foreground, I just have a "loader" method that is called both from application:didFinishLaunchingWithOptions: and applicationWillEnterForeground:.
Works well for my software on my 3G w/ 3.0 (I refuse to upgrade after seeing iOS4 on a 3G!) as well as my 3GS running iOS4.
I am dealing with an old code designed for iPhone OS 2.0. In this code I have some instructions that we deprecated on iPhone 3.0.
I am not willing to change the version because I have many customers, specially on iPod Touch, that are still using 2.0. If I update the instructions they will be unable to continue receiving the updates.
The application is compiled for 2.0 and always have been like that.
I have submitted a new version for Apple, where some bugs were corrected and new functionality was added. I have always sent this app to apple and they never complained. Now they rejected the application telling me that it is crashing under OS 3.1.3.
I've followed their instructions but I don't see any crash and the part of the code that uses the "deprecated" function works perfectly on 3.1.3.
Compiling the project for 3.1.3, I see a yellow warning on Xcode telling me that one instruction was deprecated on 3.1.3.
The big question is: will this instruction work on 3.1.3 and should I ignore this warning?
Can this make the iPhone crash?
In my mind, all new versions of the iPhone OS keeps back compatibility with older versions, so, as I think, any application compiled for 2.0 will run on 3.1.3 and all versions up.
As you see, I have tested this on 3.1.3 and the application works perfectly.
How can that be? Any ideas?
thanks for any help.
Deprecated calls are designed to work in the OS release that they became deprecated in, but stop working in some (undefined) future OS. The deprecation is a warning to developers: Hey, you should change your code, this WILL break in the future. It's a way to update the API-base without breaking everyone.
In summary, you're okay to use these calls now, but you'll want to edit the code should you ever decide to ditch 2.x operability.
My app was built with SDK 2.2.1 version even before 3.0 beta appear.
User going to install my app to the last iPhone 3Gs with 3.0 FW version. Will my app behave differently with last iPhone? Will items described here (3.0 OS Release Notes) influence to my app which was build with 2.2.1 SDK?
For example Apple doc tell:
FIXED: UINavigationController won't resize content view automatically if barStyle is changed to/from UIBarStyleBlackTranslucent.
But my app use this style and I saw content view resize before with iPhone 2.2.1 OS...
What does it technically mean when I select 2.2.1 or 3.0 SDK as active in XCode for my project and build? Does SDK corresponded libraries linked statically?
Thank you.
When you select an active SDK in XCode, it essentially chooses the headers to compile against. The libraries are linked dynamically, so when you run an app built against 2.2.1 on a device running 3.0, it will have the 3.0 library behaviour.
For the specific fix you quoted, it may be that content failed to resize under certain circumstances which never affected you in the first place. But the long and the short of it is that you won't know exactly how your app behaves under 3.0 until you try it.
Selecting an active SDK in Xcode tells the compiler which version of Apple's libraries and frameworks to build against. If you're using code that Apple changed or marked bugfixes on between 2.2.1 and 3.0, then yes, you will see different behavior in your app.
For example, between iPhone OS 2.2.1 and 3.0 Apple deprecated the UITableViewCell initWithFrame: initializer method. In 2.2.1, code that created table cells using this initializer worked fine. They will still work in 3.0, but you will receive a deprecation warning from Xcode, and you should update your code because Apple may remove deprecated pieces of the framework at any time.
Other changes are more behavioral, like the one you mentioned. If your application relied on a content view resize when you change the bar style, and that resize no longer happens, unexpected things may occur in your app.
The best approach to take is to build your app in 3.0 and test it thoroughly. Go through the compiler warnings and update code as necessary, then look at other changes Apple made and where you use those bits in your code.
Side note: As I understand it, Apple is no longer accepting applications into the App Store that have not been tested on 3.0 (nor have they been for some time).