Xcode 11.2.1 confused about the minimum deployment target - xcode

I have a library and an app in the same workspace. One is dependent on the other. When I compile I get an error saying that the library is build for iOS 11 but the apps deployment target is iOS 10.
I change the minimum deployment target for the library. Same error.
I change the minimum deployment target for the app. Same error.
I clean the build folder, delete the derived data, reboot the computer. Same error.
The minimum deployment target can be changed in two places in the project settings, either in the info tab or the build settings tab. They both seem to be in sync.
Is there anywhere else it is stored?

Here is how I fixed it. Right click on your project file (something.xcodeproj), select 'Show Package Contents'. Open project.pbxproj with a text editor and search for IPHONEOS_DEPLOYMENT_TARGET. There will be 4 hits, 2 for Release mode and 2 for Debug mode. One of the Release mode values and one of the Debug mode values will be wrong. Hand edit them to the correct values. After this I checked my other projects. Every single one has inconsistent values for the minimum deployment target. I have a feeling that this is a problem with xcode 11.2.1 as this is the first time I have had this problem, but I am not sure. Has anyone else had this problem?

Related

ResearchKit.framework error: Image not found

I have an Objective-C app I wrote roughly 12 months ago, with the iOS Deployment target set to 12.1 . I added the ResearchKit framework to it, and during the time of development the app was working fine. What I do remember is that it only worked on an actual device and not on the simulator.
A year later Im back to make changes, using Xcode 11, and am now getting a familiar error, solution to which I cannot figure out. This is both on real device and simulator.
I have done all that is required to add the library. See attached images below:
TARGETS -> General Tab
TARGETS -> Build Phases
ERROR
Attempting to run on an iOS 12 device fails too. Is there something I'm missing?
I ended up removing the pre-build Research.framework and adding the full Project instead:
Remove the Pre-built ResearchKit.framework file, select Move to Trash when prompted.
Make sure the ResearchKit project is closed (if it's open it wont be added as a project but as a file)
Drag and drop the ResearchKit.xcodeproj project file, into destination project. After this make sure the ResearchKit project has its files under it.
Go to Main project file of your project (not ResearchKit) and select your Target.
Make sure ResearchKit.framework is listed under Embed Frameworks. If not, then add it by selecting the + button and selecting it from the list. If it is not on that list then build the ResearchKit project to create the .framework file.
Under the same Target, go to Build Phases, and make sure ResearchKit.Framework is added under Link Binary with Libraries, and also under Embed Frameworks. If not then add it where absent.
Build and run.
There may be better ways to resolve the issue, but for now this works for me to run the App. App now runs on simulator. However, an initial build takes up-to a minute because the ResearchKit project it pretty big.
Update: I later figured out that the reason why I was encountering the 'Image not found' error is that I was trying to run on simulator while the ResearchKit framework had been build to target arm64 (real device). You will have the same issue the other way around (attempting to run on device-arm64 while app was build for simulator).
So how do the above steps fix this? That fixes the issue because by having the ResearchKit project files included you get to build everything for the currently selected architecture, whether device, or simulator. Happy coding.

How do I stop Xcode 9 from continuously building or at least make it not run build scripts?

After migrating to Xcode 9, I noticed that it constantly fully builds my project. I found that it is somehow related to the "show live issues" setting. Disabling that setting stops builds, but it makes development inconvenient.
I would like to disable this continuous build loop, or make it work without launching all build scripts.
My custom build scripts contain linting and formatting, so what happens is, I try to edit a file, but Xcode starts building, thus launching the formatting routine that changes exactly the same file I am trying to edit.
Open any .storyboard file in your project and go to the Editor menu, uncheck 'Automatically Refresh Views'.
After upgrading the Xcode version to Xcode 9.0, I also faced a similar issue and my CPU usage was jumping upto 50% just because of Xcode. However I could solve it by following the steps below.
In the Toolbar go to:
File -> Project Settings / Workspace settings change Build System to Standard Build Settings under Shared Workspace Settings. Also under Per-User workspace Setting change Build System to Standard Build System.
The release notes also say the following.
"Xcode 9 includes a new build system written from scratch in Swift. It
is designed for higher reliability, and it catches project
configuration problems that the standard build system does not. The
performance of the build system (not including compilers, linkers, and
other build tools) has been dramatically improved."
So there could be a possibility that there are still bugs in the new build system.

Issue in using "New Build System (Preview)" new feature Xcode 9 Swift 4

In Xcode 9 “New Build System (Preview)” option in Build setting (as in the image shown below) has been introduced and it is used for improving build times for the projects as stated in the WWDC session(https://developer.apple.com/videos/play/wwdc2017/402/)
It works fine for new projects which I created in Xcode 9 recently.
But it doesn’t work for my older projects(big ones), And I found the following similar kind of issue log for most of the projects
error: unable to build node:
'/Users/admin/Library/Developer/Xcode/DerivedData/PROJECTNAME/Build/Products/Debug-iphonesimulator/PROJECTNAME.app/Info.plist'
(node is produced by multiple commands; e.g.,
‘313423sfkjsahdfkashdfklahsdlfkjhsalkfjhh33123sfas:CopyPlistFile
/Users/admin/Library/Developer/Xcode/DerivedData/PROJECTNAME-hgfopfsnfsimmzcupjfdhkomofte/Build/Products/Debug-iphonesimulator/PROJECTNAME.app/Info.plist
/Users/admin/Projects/Official/PROJECTNAME-ios-2100bd9ec02e/PROJECTNAME/SupportingFiles/Info.plist'
and
'313423sfkjsahdfkashdfklahsdlfkjhsalkfjhh33123sfas:ProcessInfoPlistFile
/Users/admin/Library/Developer/Xcode/DerivedData/PROJECTNAME-hgfopfsnfsimmzcupjfdhkomofte/Build/Products/Debug-iphonesimulator/PROJECTNAME.app/Info.plist
/Users/admin/Projects/Official/PROJECTNAME-ios-2100bd9ec02e/PROJECTNAME/SupportingFiles/Info.plist')
How to resolve this issue ?
I had the same problem, search for .plist files in the "Copy Bundle Resources" phase, there shouldn't be any plist file there, in my case this was preventing the new build system to build.
I know this is solved, but mine was a different cause. I had two 3rd party SDKs that had simple text files with the same name (LICENSE). This was probably just a warning in the old build system.
I just removed one of the files from the target and everything works again.

Duplicated target: Xcode cannot run using the selected destination

(OS X, not iOS): "Choose a destination with a supported architecture in order to run on this system"
Fixed the copied .plist in the Build settings, removed spaces from the new product name. Can't find any difference with the original target's settings, still this dreaded error. Any ideas?
I got this error when I opened an old project under Xcode 4.5. The problem: The build setting were set to Standard Architecture, which means 64bit and 32 bit, while the minimum deployment target was set to OS X 10.4.
Setting the minimum deployment target to OS X 10.5 fixes the problem.
When i faced this issue, on top of the xcode window i changed My Mac 64-bit to My Mac 32-bit. It worked for me.
For me it was a mismatch between the filename of the executable, as specified by "Product Name" in the target build settings, and the executable filename indicated in the Info.plist. In fact, when you duplicate a target, you get a "copy" suffix that you usually change right away, and this may lead to some mistakes.
An additional indication of this mismatch can be seen when selecting the product app in Xcode, and opening it in the Finder. If the app icon is overlayed with a kind of "stop" sign, here it is, your app isn't executable.
If everything looks alright, one last thing that you should check contents of your app.
Most probably application name Info.plist file does not match what you have in your build configuration.
With Xcode 4.5.2. (4G2008a) this issue has gone away, apparently. I can now make a duplicate of the original target, fix the product name, and get a properly running application.
I started getting the same thing. I did a Clean and it seems to have fixed it.
Lion/Xcode 4.6.2
I got the same error message after accidentally copying a binary to /usr/local/bin. The binary was "manually" generated by Makefile - the building process of Xcode (5.1) was configured to place the binary in /usr/local/bin too. Removing the manually generated file and starting the build again fixed the problem.

Limit or change Scheme Destinations in Xcode 4?

Overview & Motivation
I would like to set up some Schemes that build for iOS Device only.
For example, I never want to build an Ad Hoc build with a Simulator destination. The ability to choose Simulator destinations for an Ad Hoc build is just noise.
Desired Behavior
Actual Behavior
What I tried
I removed the "iphonesimulator" value in "Support Platforms" in the configurations that are meant to be device-only, like so:
In the Ad Hoc scheme settings, I disabled the run and profile steps. I left the archive step
For all Build steps (including the disabled ones) I set the Build Configuration to "Ad Hoc", which was previously set to iphoneos only.
Results so far
I can still select Simulator as a destination in the scheme dropdown:
However, if I run the scheme with a Simulator destination, I get an expected, appropriate error:
It would be much nicer for myself and my team is would could just hide these invalid destinations.
Is there a better way to manage what destinations are available for a given scheme?
Updated Answer
Hmmm. This works for me with ONE target. I removed the platforms from the Supported Platforms in the configuration and they disappeared from the Scheme.
I then tried adding another configuration that allows the simulator and it's still just the device destination visible. Then I duplicated the target and added in iphonesimulator ... and the simulator shows up in the scheme for both targets.
Unfortunately, I think the available destinations are an aggregated list of those available to all targets. File a bug report: http://bugreporter.apple.com
Another Update
AH! It looks like an Xcode bug with updating the Scheme selector! I configured each target's settings - one to omit the simulator and the other to keep it - then closed and re-opened the project. Magically, the first target had only the iOS Device destination while the other target had the device + simulator destinations.
So, the answer may well be to duplicate your desired targets and set them to allow only the device, then make sure your scheme is properly named so you know which target is being built. Close and re-open the project and the list should show up just as you'd expect.

Resources