Debug for iOS 3.x in xcode with SDK 4.1 - xcode

I've downloaded the latest SDK from developer.apple.com and can only pick 3.2 or 4.1 from Project > Properties > Base SDK.
My iPhone is 4.1
My client have iPhone 3.x
You feel the problem...
How can I debug for iOS 3.x in xcode with the 4.1 SDK installed?

Actually that's a very frequent question (was lazy, only linked one).
Short version: you need to set your Base SDK to the highest SDK version you've got and your project's Deployment Target to the lowest version you like to support, e.g. 3.0. This means, the Deployment Target specifies the oldest version your app should be able to run on. But beware, this setting does not prevent you from accidentially calling, say, methods available since 4.0 on an 3.0 iPhone and thus causing a method missing exception.

This isn't possible have I come to understand.
You have to buy a old iPhone 3.x.
If you want my opinion on this, then I think this is horrible, frustrating and completely not understandable.

Related

Xcode 4 & Mac OSX 10.3?

I'm new at programming on the Mac. I've got me a brand new copy of XCode 4.0. I've got people asking me what versions of MacOSX we'll be able to support but I'm not sure what to tell them.
I see options for selecting an "SDK" and other options for selecting a target version. It seems the lowest I can go is 10.4 though -- even though we'd like to support 10.3, if possible without a lot of pain.
My question is, could anyone give me a quick rundown of how sdk versions and target versions fit into this? As I'm coding, what kind of things do I need to watch out for to make sure I can still support the smallest version of MacOSX? Likewise, how do I figure the G4/G5 (PowerPC) versions of MacOSX into all this? For example, on Windows, if I write an app in c#, I know that all I need to do is make sure an appropriate version of .net framework is installed, regardless of the OS. Does something similar hold true for the MacOSX?
Thanks in advance.
I believe Apple has dropped PowerPC support completely, including Rosetta, in Mac OS X so 10.3 is out of the question.
If you want to support PowerPC, see this related question. It looks like a lot of work.
How can we restore ppc/ppc64 as well as full 10.4/10.5 SDK support to Xcode 4?
With the analogy to the .NET Framework, there isn't anything like that for Mac OS X built-in.
It is true for Mac OS X. If your program targets 10.3 SDK, it will be able to run on 10.3 or greater. I.e. the Base SDK project setting specifies minimum target OS version.
However, supporting 10.3 IS a lot of pain. Even 10.4 is not that easy, for example Objective-C 2.0 (most important, #property, garbage collection) is only available with 10.5 SDK or above.
The common solution in existing projects is to keep an old version of software available for 10.1-10.4 users, while the new versions will require 10.5 or greater (and also usually are Intel-only).
If you're starting a new project, you will probably want to distribute it via Mac AppStore, which only works on 10.6+, which means you can safely pick 10.6 SDK as the lowest target version.
Apple is way more harsh about upgrades than Microsoft. Mac users don't walk around with 10-years old systems on their laptops. The only reasons I can think of to still use 10.3 are using 10-year old mac, not having Internet connection and not knowing what “to update a software” means. So, I wouldn't care even about 10.4, not to say 10.3.

Explicitly set base SDK to 3.2 to catch compiler errors

We're building an iPad app and don't plan to use any APIs that are not available in iOS 3.2. Our deployment target is already set to 3.2, but I would like to set our base SDK to 3.2 so that we get compiler warnings/errors if we accidentally invoke APIs not available in 3.2, rather than runtime failures.
Is this a good idea? If so, is the 3.2 sdk still available for download, and will older sdks work with newer XCode versions, like 4? Thanks.
There's no guarantee Xcode will support older SDK versions but as an example the current install of Xcode 4 goes all the way back to 3.0. I would drop 3.2 if I were you (few iPad users are on that; most iOS apps enforce 4.X in the App Store so I'd bet most people have upgraded) but if you are going to support it perhaps you should consider using conditional code for different OS' versions.

Is Xcode 4 ready for iOS development or still too beta?

I am just starting iOS/iPhone development and I would like to start using XCode 4 instead of XCode 3.2. Is XCode 4 stable/feature complete enough for beginning iPhone development or should I stick with XCode 3.2?
I have run into far too many problems using beta versions of XCode, especially since you can't really have two versions of XCode one the same system. Apple already has a history of releasing things to developers before they are truly ready (just look at iAds for the iPad which were released months ago and have yet to deliver a single ad). So, if even Apple isn't ready to label XCode 4 as ready-to-go then you can rest assured its not really ready to go.
I recommend sticking with 3.2. That's what I'm doing until XCode 4 is officially supported.
Using XCode 4 calls everything you do into question. Having a problem with an API? Maybe it's XCode, maybe its your code, maybe its a bug in the API. You just don't know.
I would say no, it's not ready. I tried using it as my main development environment for about a week, and eventually switched back to 3.2. For one thing it crashed fairly regularly, but I could get passed that.
The big thing that caused me to switch back was a bug where the iOS simulator would think that certain resources existed in my app that didn't. Deleting the app from the simulator didn't work, cleaning the project didn't work, and deleting the derived data folder didn't work. Since it's not officially released, finding help for problems like this is a pain as well.
This is just one instance of the kind of problems you'll run into while using it, so I'd recommend avoiding it for now.
You can use Xcode 4 if you do not plan on using the current version (Preview 6) for submitting apps to the App Store.
iOS Dev Center:
Xcode 4 Developer Preview 6 includes
iOS SDK 4.2, bug fixes, and additional
features. To compile submissions for
the App Store, continue to use Xcode
3.2.5 and iOS SDK 4.2.

iPhone - UIMessage.framework

In an iPhone application, we are supporting sending text messages. For this we have to integrate UIMessage.framework in the application. This feature is supported only in OS 4.0 or above version. In the implementation, however, I have disabled the feature if the device OS is earlier that 4.0. However, the issue I am facing is that for devices earlier than 4.0, tha package cannot be installed, simply because the framework needs is included in the package.
Is there any work-around for this issue? Is it possible to have a build in such a way that only if the OS is 4.0 or higher, this framework is included while for earlier versions, this is not needed. Or am I missing something here?
Thanks
Set the UIMessage framework to be weak linked in your application's targets. That way, it's conditionally linked at runtime when needed.

Do I have to compile my iPhone app with 4.2?

I have iPhone application in the App Store. Do I have to compile my app with iOS 4.2 SDK in order to allow it run on iOS 4.2 devices? Or compiling using iOS 4.2 is required only to allow using new features of new iOS?
I will appreciate if you can clarify this issue...
Thanks!
Yoash
Do I have to compile my app with iOS
4.2 SDK in order to allow it run on iOS 4.2 devices?
No, it will run on the new firmare just fine. At least if the new firmare does not reveal some bugs in your code (which happens).
You don't need to recompile it to let it run on newer OS versions, but like you already guessed, you need to recompile it when you want to use the newer features (eg. AirPlay, "Multitasking" etc).
The old version should still run.
The app might not play well with new features like multitasking on iPad, so it is worthwhile trying to get some testing and feedback done as soon as you can in case there are issues.
If you download the XCode 4 pre-release from the developer portal, you can use the new static analyser to look for problems in the code: this is not just for SDK issues but also things like memory leaks.
Apple recommends that you always compile with the latest SDK, even if you are targeting older versions.
Unless you run into a specific issue that is causing incompatibilities, it is wise to take this advice. A lot of small bugs and performance issues are fixed with each new iteration of the SDK.
That being said - you can continue to use the older SDK's, and Apple will still accept the apps you build. For mature apps that are only going through minor tweaks, this is probably the safest course to avoid introducing new bugs.

Resources