How to solve iOS deployment target issue? - ios

I am trying to run an application I am developing on an iPhone that runs iOS 10.2.1. I also tried to run it on a simulator that runs iOS 10.2. My Xcode version is 8.3.3. Even though I changed the deployment target to 8.0, I get the following error when I try to run it on a device under 10.3. Are there other things I should pay attention when changing the deployment target other than changing it from Info tab in Xcode? The error states the deployment target as 10.3 but it is not. How can I get around this issue?
"Run destination is not valid for running the scheme.."
My deployment target
Thank you,

I remember the same issue happening in my code.
In my case, I realized that I had not updated my Base SDK to the latest iOS version in the Build Settings
To do so, click on Project name -> Build Settings -> Base SDK
If Base SDK does not show, ensure that "All" is selected in the filter at the top of the page.
Also, sometimes the project has multiple targets and you might be setting the Base SDK on the wrong target.

You need to update your iphone to the newer version or downgrade your xcode version. Currently they are out of sync thus why you are seeing this error.
See here for compatibility:
https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html

Related

Unable to launch iOS app written in Swift on device due to lower version error

I created a new iOS app project in Swift language, using Xcode 11.6 running on macOS 10.15 Catalina.
But when I try to run the app on a connected device, I get the following error:
How I can lower the app's deployment target version?
That means You current app deployment version is higher than the current using device. Choose the device iOS version greater than equal to iOS 13.6.
Even you can change the Deployment target as per your device but you should care full.
eg. Lets say an app has been done with deployment target as iOS 10 and using many api (may be) has been deprecated or not there in iOS 9. So if you run the app on iOS 9 device version it will not run (will give same error as in question) though you can change the deployment target to iOS 9 to run on device. But it could be harmful. Your app might crash. So better use device higher version than deployment target.
Click on the project file in the project navigator, select the correct target in the outline view and set the value for Target under Deployment Info to iOS 9.3 or earlier.

Why isn't Xcode (Swift 3) flagging APIs from iOS 10+ when deployment target is 9.3?

The title covers it. Latest Xcode and using Swift 3. I'm probably using some stuff from 10+, but no messages, and then crashes on an iOS 9.3.5 system. My understanding is that the compiler would flag any APIs that weren't appropriate for the deployment target. Is there a setting I missed? Am I wrong in believing the compiler will flag offending APIs?
Most other questions about deployment targets seem to be pre-Swift 2, and the later ones seem to say they should be flagged.
Thank you.
I think Xcode swift compiler will only flag when you build against the selected iOS version. Try downloading iOS Simulator 9.3 and then select it and build. Deployment target doesn't cause any warning unless the current iOS version selected in the dropdown during build time doesn't support an API.

Methods from new iOS-version, not giving warning, dispite of older SDK

I have a basic question about the difference between the "deployment target" and iOS version availability. By example:
In my project I use this line of code:
I Xcode i setup the project like this:
and it matches the deployment info under the specific target as well.
When I run this code, it works.! But why?
How come I don't get any warnings?
My deployment target is lower than the availability for that specific line. Why dosn't the compiler give me an error here? I'm testing the code on my iPhone with iOS 9.1 installed, is that why? The same thing happends when I run it on the simulator, also with iOS 9.1
EDIT:
After reading through the App Distribution Guide and SDK Compatibility Guide, I still dont get, why I'm allowed to run "MKMapSize"-method, when my base SDK is set to iOS 8.0, whitout getting any warnings? See image from target settings -> build settings:
EDIT 2:
I found an example of a new method that does give med the error I'm asking for:
Why does this method give me an error, when the 8.1 method doesn't give me an error?
EDIT 3:
So if I go along and uploads this project to the app store, will the app work for users running iOS 8.0? or will it crash when MKMapSize (which is available in iOS 8.1 and later) is executed?
MKMapSize was added in iOS 4 according to the documentation:
Availability Available in iOS 4.0 and later.
I too have noticed that the mouseover popup "lies" regarding the availability. It seems to use the version you're targeting and not the actual availability specified in the code, if the actual availability version is lower than your deployment target.
It's either a bug, or it might be because iOS 8.1 is the earliest SDK you have installed on your machine.

How to deal with Xcode update to recommend settings warning?

Recently, I upgraded to Xcode 6. Anything works well except I got a new warning indicates me to upgrade iOS Deployment Target to 8.0. Bellow is a screen shot of the message.
However, I don't want to upgrade deployment target because I want to support any device that has OS version 7.0 and above.
How to ignore this warning? Or perhaps iOS Deployment Target setting has nothing to do with the lowest OS version that my app can support?
I think there is a bit of confusion here, there is a difference between the Base SDK setting and the Deployment Target. Deployment target determines which versions of iOS you support, the SDK version simply determines which version of the SDK you are using to write your code. As long as you don't use any code which requires iOS 8 (Or if you want to use it check that it is available: Checking For Class Availability). So to fix this, you should click Perform Changes. You will still be able to run your app on iOS 7 :)

Error message when compiling in Xcode 4

As of today I can't compile my iOS Xcode project anymore. Immediately a message box pops up saying:
The run destination iPhone 4.3 Simulator is not valid for Running the scheme 'MyApp'.
The scheme 'MyApp' contains no buildables that can be built for the SDKs supported by the run destination iPhone 4.3 Simulator. Make sure your targets all specify SDKs that are supported by this version of Xcode.
I've already played around with various settings in Xcode but nothing helps.
Does anyone know how to solve this?
Thanks!
Just a wild guess, but did you have a look in your project settings under Base SDK? Does it say e.g. Latest iOS (iOS 4.3) ?

Resources