UIInterfaceOrientationMaskAllButUpsideDown showing error while making a build - iphone

I am making an app having deployment target 4.3, but my base SDK is 6.0.
Now when I make build then the compiler is showing error about usage of UIInterfaceOrientationMaskAllButUpsideDown.

that symbol isnt defined in 4.3 and so it doesnt work :)
ios6 changed how VCs tell it about supported rotations
implement the old way using shouldAutorotate:

Related

Error making app compatible for iOS6 and iOS7

I built an app on XCode 5 for iOS7 and have just downloaded the iOS6 SDK so I can make the app compatible for iOS6, however when trying to build the project I am getting this error
Undefined symbols for architecture armv7:
"___sincos_stret",
What should I do to solve this because I really need my app working with iOS6
Here are my current settings:
set the Base SDK to ios7 and set the deployment target to ios6
that way you get the headers for 7 but the app is compiled to be run on ios6
__sincos_stret is new to iOS7. Make sure your deployment target is set to iOS6. See semi-related question here: ___sincos_stret undefined symbol when linking
Update: You need to set the Base SDK to iOS 7. You generally want to set Base SDK to the latest version you intend support, and Deployment Target to the earliest version. See related question: Base versus Active versus Deployment target

Create project for iOS5 on XCode 4.6

Tell me please, how can I create project for iOS5 + in my XCode 4.6, where all builds for iOS6 +
I change Deployment Target
And how change base SDK? Or maybe I cann't change it?
And what I must do, that my XCode show me warnings if I will try use methods, that can be used only in iOS 6+?
First you should understand a few things. Deployment target is the minimum OS version that your app supports. If you set into iOS 5.0 you can assure that it's support iOS 5.0 and above. Base SDK is the SDK which is used to compile your application. Always use latest SDK available.
If you want to create app that support iOS5.0 and above set deployment target as 5.0. Then use latest SDK available. The reason is that if you change base SDK to some lower version, your app may not support ios6 since some of the methods are deprecated in iOS6. If you compile it with latest SDK it shows warning. You can test your app by installing different simulators to check wether it is working properly. Mainly you need to handle orientation issues since it is different in both.
You can use conditional compilation. Remember not use autoLayout and attributed strings. Which wont support in ios5
For your first question as far as I know ios 5 api will also be supported in later versions. You should set your target to ios 5.0 (via your project target settings) for making sure that none of the ios6 methods are used (or else a compilation error will prevent you from building it).
In order to support new features and check if ios6 is available on the device you have two ways :
During compilation (so you can still build your app with lower targets and newer together) use the following macro
#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0
// Your ios6 code goes here
#endif
2: During runtime : [[[UIDevice currentDevice] systemVersion] floatValue] > 6.0

Why can't I compile with iPhone OS 3.0 as a deployment target in Xcode 4.2?

I have an iPhone app which was developed with 4.0 as the base SDK and a deployment target of 3.0. Everything was working fine.
Last week I upgraded to Xcode 4.2. Now when I open the existing project, I can't compile with a deployment target of 3.0. It compiles successfully and runs only when the deployment target is 4.0.
I get the following error when I set the target to 3.0:
Unsupported compiler 'GCC 4.2' selected for architecture 'armv7'
The compiler which I use is LLVM 3.0. I am not using ARC.
Should I go back to the 3.x SDK? Is there a way that I can support 3.x using Xcode 4.2?
Uhhh, don't?
That might sound flip but iOS 4 has achieved pretty good penetration. Looking at Intstapaper's data says it really isn't worth it. And the "accepted" answer at this stackover flow answer even suggests just supporting 4.2!
Now, of course, you may have really good reasons for wanting to support 3, perhaps you are working with an Enterprise client who needs 3. In which case, just completely disregard what I've said.

How to use xcode compiler warnings to determine minimum IOS deployment target

I'm building an iOS app using Xcode 3.2.5 with the Base SDK set to iOS 4.2
I know I've used some api's from 4.0 and 4.1 but not sure about whether I actually require 4.2.
According to the iOS Development Guide, "Xcode displays build warnings when it detects that your application is using a feature that’s not available in the target OS release".
So I was hoping to use the compiler warnings to derive my minimum OS requirement.
However, even when I set my iOS Deployment Target to iOS 3.0, I still don't get any compiler warnings.
I must be doing something wrong, but not sure what? Can anyone confirm that they get compiler warnings when the iOS deployment target is less than the base SDK and the code uses base SDK functions? Or do the compiler warnings only show if you link a framework that didn't exist in the iOS deployment target version?
It's behaving as expected: changing the deployment target only affects the minimum OS version you app will run on, not the maximum.
If you use the 4.3 SDK and set the deployment target to 4.0, it just means your app will hard-link any pre-4.0 APIs and weak-link any APIs introduced between 4.0 and 4.3. You have to check at runtime either for the existence of the API (e.g. null pointer for C functions) or the OS version.
The deployment target does generate Xcode warnings but for deprecated APIs: for example if you use an API deprecated in 4.1 and later and the deployment target is 4.1 or later, you get a warning, but if it's 4.0 or earlier, you don't.
It looks like what you really need in your case is the equivalent of MAC_OS_X_VERSION_MAX_ALLOWED (it's not part of the default build settings, but you can custom define it and it should override the value set by the SDK) but for iOS SDK. I'm not sure it officially exists actually: I was able to find a __IPHONE_OS_VERSION_MAX_ALLOWED but considering it starts with __, I'm not sure it's really supported.
The right solution appears to simply build against previous versions of the SDK (you can always do that in the Simulator) and you will get Xcode errors if using missing APIs.
For more info, read this technote: http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html
temporarily change your base sdk to see them
Edited: for detecting new APIs that are only available in new versions of iOS, I don't think Xcode can do it automatically for us. We need to put them in our mind by ourselves. My suggested reading source:
Login into your dev account and search API diffs. These official API diffs documents should be thorough and helpful.
Check this great post on how to wrap up your code to make it compatible on lower versions of iOS:
===
Try clean your project's build folder. After that you should see warnings on deprecated APIs that your code used.

animateWithDuration not available

i started a project with the iOS SDK 4.0 and want to use blocks in order to animate some UIViews. But after I recogized that "animateWithDuration" isn't available i updated my XCode and iOS SDK to 4.2. In my project I set the "base sdk" to 4.2, too.
I thought that might solve the problem. But XCode still complains about the missing method. Is this method not available for simulator builds? Or what do I have to do in oder to activate it?
Thx.
kie
Look in the project build settings for the Deployment Target setting. This is the lowest version of the SDK that you're interested in supporting. If it's lower than 4.0 then all of the pre-4.0 methods will be stripped out by the compiler (since they won't be available on the devices you're planning to deploy to). Try setting it to 4.0 or later; that should help.