I have been developing an iPhone app. and had the Base SDK set to "iPhone Device 3.0" and Deployment target set to "iPhone OS 3.0". Everything worked fine. I recently realised I actually needed to compile the project to run on devices using version 2.2.1 of the SDK, so I set the deployment target to "iPhone OS 2.2.1". Now when I hit compile I get 2079 errors all eventually pointing back to my header files saying "#endif without #if". My header files are surrounded by #ifndef/#endif clauses and I have checked every single one of them and all of these match up (since it compiles targeting 3.0 I'm assuming this isn't the problem anyway). I am using XCode 3.1.3. I have no idea what is going on and would appreciate any help with this. Thanks.
First thing to check is that you aren't using libraries that are only available in the 3.0 SDK. If you are using the MPMediaPlayer Framework, for example, you will probably get some compile warnings since those libraries don't exist prior to the 3.0 SDK.
My general advice for compile errors is to start with the first error and work your way one at a time. Generally, a single failure at the top will cascade and cause many more compile errors than actually exist in your code.
I found the answer, I had the target SDK set to the wrong version (2.2.1), when it should have been set to 3.0.
Related
I have a question regarding compiling against SDK's, which I thought I understood until yesterday.
I have an iPhone app, which the version compiled against SDK v3.2 and running on an iPhone emulator runnning version 4 works fine, but when I recompile the app against SDK 4 the interface starts to mess up.
I thought when you write an app against an SDK/Frameworks like iOS or the Android SDK's, the code you write gets compiles into an app (with any added libs), and then get excecuted on the system. The sdk being present on the dev machine for the purpose of the app being able to compile (and run compile time checks) but not actually compiled into the app code.
What I dont understand is that if this is the way it works, how can just compiling against a newer version of the SDK break the app (bearing in mind whatever version it is compiled against it is still running on iOS version 4) as how is it not still the same compiled app.
Obviously I am missing something here!
Thanks for any pointers
Any number of reasons; when you target a particular version of the OS, it can change the set of APIs that are available and it can change how the app is linked. At runtime, the system can do what are called "linked on or after" checks. If your app was linked with a target of an older OS, the newer OS might preserve some behavior or make sure a bug still exists. If targeted to the newest OS, you get the new behavior.
All of this is to say that you likely have some issue in your code where either you were relying on a bug in the 3.x versions or you are using an API whose behavior has changed between the two versions.
i have a iPhone Project with Base SDK 4.0 and Deployment Target set to 3.0 with XCode 3.2.3. Is there an "easy" way to find out whether i use iOS 4 only API calls in my Source Code. I'm aware that i could install an old XCode to run my project against an e.g. 3.1.3 Simulator, but i hope there is a simpler way for checking this.
Anybody has an idea?
Thanks
Roland
Set the SDK to a 3.x SDK and recompile. If you have any new errors or warnings, it's probably a sign you have 4.0-specific code, and the errors will tell you where.
I just updated to iPhone SDK 4 and am trying to debug on my device with 3.1.3 installed. Before the update, I compiled with Base and Active SDK set to 3.1.3 and all was well. After the update, I'm limited to SDKs 4.0 and 3.2--setting the base to 4.0 and iPhone OS Deployment Target to iPhone OS 3.1.3, I'm able to build and install on my 3.1.3 device, but receive the following error:
Error from Debugger: mi_cmd_stack_list_frames: Not enough frames in stack
I'm not using anything specific to the newer SDK, as I haven't touched a bit of code, just updated the SDK/XCode. So what am I doing incorrectly? The application runs as expected on an iOS4-installed device. Are there changes to pre-existing API's that need to be weakly linked perhaps? Thanks for all help.
Have you tried removing the app completely from your dev device, doing a build -> clean all targets, and then build again to your device?
I found this answer on macforums. If it's correct, then you probably have a memory corruption problem in your app that is confusing the debugger. Perhaps over-releasing something somewhere.
This probably isn't related to the SDK you are compiling with. It's possible you had this problem in your app all along but it just didn't show up until things moved around with the new Xcode, SDK, etc.
EDIT - I just ran into this problem myself trying to update an older app of mine to 4.0. It would run fine in the simulator and would install and run on the device except it wouldn't run in the debugger on the device. Anyway, I finally decided it was the .xcodeproj file that was corrupt or bad in some way and created a new project, copied over my source files to the new project and now it all works again. It's a pain but it only took about 20 mins to duplicate all my settings and I spent a couple hours trying to get the debugger to work.
Myself (and probably many others) are concerned about "will I still be able to compile/install apps for v3.1.3 of the iPhone OS?"
And what version of xCode does it become IMPOSSIBLE to ever write v3.1.3 apps again?
(Without installing a second copy of an older version of xCode.)
I've read the mile-long document that Apple wrote on the subject... but it sure would be simpler to understand if they just LISTED the various versions of each... instead of writing long paragraphs.
If you have:
Mac OS version 10.x.x x
xCode version x.x.x
SDK version(s) x.x.x
you can produce apps for iPhone OS x.x.x through x.x.x?
I'm building my iPhone app under SDK 3.1.3. My Base SDK and iPhone OS Deployment Target are both set to OS 3.0, but when I build, the info.plist in my bundle shows a MinimumOSVersion of 3.1.3. What could cause this?
(source: skitch.com)
I was ultimately able to solve this problem by switching my iPhone OS Deployment Target to some other version (e.g. 3.1), building, then switching it back to 3.0 and building again. Somehow this coerced XCode into behaving as documented. I don't really know why this fixed the issue, but it did. Perhaps it resolved some kind of corruption somewhere inside the .xcodeproj.
Did you check other projects, libraries, that are included in your project, that they all compiled/linked with the same Base SDK & Deployment target version?
I had same problem, till I realized, that I had a library that was built with a higher version.
After my upgrade to Snow Leopard and Xcode 3.2 (which I really regret a lot!!), Xcode lost all the SDK's. I'm one of those old-fashioned idiots who still want to develop for 2.2.1. But Apple does not offer me an old SDK download.
Now I was clever and made tons of time machine backups. But: What's the preferred way to get iPhone SDK 2.2.1 running with Xcode 3.2? Some guys said that's generally possible. I do hope so because I still don't believe in all those "faked" stats, and besided that, my app doesn't benefit from 3.x additional features so I would not want to constrain my market just for that lazyness.
Any idea?
Regardless of whether or not you're targeting iPhone OS 3.0 or not using any 3.0 specific features, you should always compile your app against the latest SDKs to benefit from bug fixes and performance improvements.
You can compile against the 3.0 SDK and set the iPhone OS Deployment Target to 2.2.1 and still cater for users who are using 2.2.1.
You may find that some methods have been deprecated, but that doesn't stop you from using them until you're ready to move on.
Get the 3.1 final sdk, it has the 2.2.1 sdk in it. On disk its usual location is:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk
Also included is 3.0 and 3.1.
XCode 3.2 should have the prior iPhone SDKs available, just make sure you are setting your project's Base SDK setting to "iPhone OS 2.2.1". (Right-click on your top-level project icon in the Groups & Files browser in XCode and choose "Get Info", then go to the Build tab.)
Raffaello and others are correct: you can use the latest SDK and still target (and test on) older SDKs. For example, I'm using iOS4.0 (xcode 3.2.3) and testing on my iPhone 3g running 3.1.3.
To clarify the procedure:
- go to project info > build tab
- set Architectures:Base SDK (most likely) the latest
- set Deployment:iPhone OS Deployment Target to what ever you want (I have the option to go as far back as 2.0).
Hope this helps someone.
Like I said on other threads, the SDK and Deployment Target are different.
You can still use the latest SDK to build for an older OS.
Just go to your Target settings and under the Deployment section set the iPhone OS Deployment Target to whatever you'd like.
Cheers,
Raffaello Colasante