New Xcode 3.2.6 only for iPhone 4? - iphone

I am wondering if using Xcode 3.2.6 will create apps that will work with all iphones,
should I use an older version ? Sorry I am green at this

You can use both Xcode 3.x and 4.x to develop applications for both Mac OS X and all of the iOS devices. You can simply select a target iOS version within your project, although you're still responsible for ensuring that you don't use iOS calls that aren't available in that version. (instancesRespondToSelector: is your friend, etc.)
However, I'd be tempted to use the latest version (4.0.1 as of the time of writing), which is available from https://developer.apple.com/xcode/ (a developer account login will be required), if only because Xcode 4 has the Interface Builder built in, has Git support out of the box, etc.

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.

Upgrade iOS application to newer OS?

I am a little curious what happens in the following situation. You have an existing app on the iTunes store (with customers) that uses iOS4, you then release an update to the app that uses a newer iOS.
folks that have upgraded to the "newer iOS" will get the update.
What will happen to those that have not updated, will they still be able to use their old iOS4 version?
Your "deployment target" is what matters. Setting the deployment target allows your app to set it's minimum required OS version. Many developers like to set that as far back as possible, unless your app depends on a features only available in a new iOS version.
Lets say you have an app compiled with the iOS 4 SDK and set 3.0 as the deployment target.
Users with iOS 3 or iOS 4 (and iOS 5) can download your app and use it.
Now you release an update compiled with the iOS 5 SDK and set 4.0 as your deployment target.
Users with iOS 4 or iOS 5 can download or upgrade your app and use it.
Users with iOS 3 that have purchased your app already cannot upgrade, but they can continue to use their existing installed version.
Users with iOS 3 that have not purchased your app yet will now have no way to do so.
Apple will only keep exactly one version of your app on the app store.
Unless they download the newer version, they will of course still be able to use the old one. It's possible however that they download the update unintentionally via iTunes on the desktop. The App Store on the device itself would check if the device's OS version is compatible with the app being downloaded, but iTunes does not, so it would replace the old version in the iTunes library, leading to the app being removed from the device when the user syncs it (because the downloaded version cannot be installed).
So, for existing apps, you should keep your deployment target as low as possible and decide at runtime which additional features of a new OS version you can use. This way, you can keep compatibility with older OS versions, but still provide additional features to those who have upgraded.
Usually (although not always), new OSes are the same as the previous ones but with new features. Older versions of apps often work with the latest OS but don't take advantage of the new features. The only problem users usually have is crash problems but it all depends on which APIs you use in your app.
Additionally, updates are never 'forced' upon a user - they are always optional. When it is a case that the app only works on a version of iOS which is higher than what the user has, then the update will not be offered to the user at all. They will still be able to use the older version that they have installed on their device. Apps have no expiry date.
If you want to retain compatibility for as many iOS versions as possible, you can set your iOS deployment target to the minimum OS you want your app to be compatible on. The SDK version number should not matter, but to support the latest iOS features, you would need the latest iOS SDK.
You will still have to check your APIs compatibility with the version you are targeting as a minimum OS. Look here and search for "API Diffs". Each document lists changes to the API for that iOS version. This will lists new and removed APIs as of that version. For example, UIPrintPaper, which is listed in the iOS 4.1 to 4.2 API diffs document, is a new API to iOS 4.2. So, when running on iOS 4.1 or earlier, the app will crash when calling that API. Using #if __IPHONE_OS_VERSION_MAX_ALLOWED <= __IPHONE_4_1 around your UIPrintPaper snipper will fix that problem.

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 develop production iPhone apps and iPad apps on the same machine?

It seems that in the future, we can just use the non-beta iPhone SDK to develop for both at once.
But for now, the only way to develop for iPad seems to be to use the SDK 3.2 beta. However, if I install that, Apple clearly states I should not submit apps to the app store with it.
I'm an independent, one-machine developer. Is there a way I can continue to upgrade my existing iPhone apps while still developing for iPad?
The Best way to do this is to install the 3.2 SDK beta in a location other than '/Developer'. On the 'Custom Install on Macintosh HD', select 'Other' from the Popup button, and point the installation to somewhere like: '/Developer-Beta'.
You can then run Xcode from /Developer/Applications for your iPhone apps, and Xcode from /Developer-Beta/Applications for your iPad apps.
If I'm reading the agreement correctly, the ban on submitting apps with the 3.2 beta applies only to the SDK, not the tools. If you set your app's base SDK to an SDK earlier than 3.2 (which it probably already is anyway), you can then build with the 3.1 and earlier SDKs by selecting them from the "Overview" menu in Xcode.
I've submitted updates to my iPhone apps built with the 3.0 SDK by the 3.2 beta tools, and they were accepted with no issue. As long as you aren't building on the actual new SDK, you should be fine.
EDIT: I don't work for Apple, I am not a lawyer, blah-blah. But it's worked for me, and the warning only specifies the "iPhone SDK 3.2". The Xcode tools aren't mentioned.
If you install 3.2 the Active SDK menu looks like
Xcode http://img.skitch.com/20100310-xkbqnbr6h4f2q55wk2wppjx3h2.preview.jpg
However, under Project settings you can change the SDK as follows:
Xcode http://img.skitch.com/20100310-xqkuracw73jb5y7uwtt7yurjs1.preview.jpg
So you can developed for any OS version using the same machine, etc.