Xcode 9.2 / iOS 11 / Can't find folder - ios

Apple recently demanded I upgrade my iPhone to the latest iOS version (11.2), and, as usual, Xcode then refused to connect to it unless I upgraded Xcode, which, of course, I could only do, if I upgraded my version of Mac OS.
So, after wasting half a day downloading and installing updates, I'm now on Xcode 9.2, and my code, which built beautifully before, fails to build with an error of:
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/
Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk/
Developer/Library/Frameworks'
(Note: I've added spaces in that folder path myself, to make it readable here.)
The error message is true though.
If I attempt to go into that folder, I can get as far as the iPhoneOS11.2.sdk folder, then there's no Developer sub-folder in it.
I have Googled this problem, and lots of people recommend checking your "Library Search Paths" and "Framework Search Path" settings... but in my case, both of these were blank. I didn't have any folders specified in my build settings.
Interestingly, in that screenshot above, I noticed that the System folder does have a Library\Frameworks subfolder so (out of desperation) I copied the System folder into a folder called Developer.
Ridiculously, this seems to have fixed the problem, but surely I'm missing something here...
Has anyone else had this problem, specifically since upgrading Xcode ?
After making this change to the folder structure, I did still have 1 other error. Xcode was now complaining that:
embedded dylibs/frameworks are only supported on iOS 8.0 and later
Again, this error hadn't appeared before I upgraded Xcode, but the fix was to change the iOS Deployment Target in my "Project" build settings and in each of the Target build settings.
What really bugs me about Xcode is that I don't want/need any of the new iOS 11 functionality. This is a legacy in-house app, which we've been using since iOS 7. This stuff should just build, after an Xcode update, but with each release, we get new problems, as obscure as the ones highlighted here.
This Xcode stuff is truly terrible... please can I go back to my warm-and-cosy Microsoft environment now...?

You can use your old Xcode to support 11.2
To support you need to run below command:
sudo ln -s PATH_OF_NEW_XCODE_DEVICESupport_TO_11.2 PATH_OF_EXISTING_XCODE_DEVICESupport
Example:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/11.0 /Applications/Xcode821.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport

Related

XCode 12.5 w/ MacOS 11.3 - Fails to Archive: Illegal Instruction: 4

This question has been asked a few times in the past, but none of those answers seem to match what is currently going on.
I have an app (SwiftUI) that builds, runs, tests fine on simulators and devices. But when attempting to Archive for iOS and/or MacOS, the archiving fails with a vague error "Illegal instruction: 4". The compiler then lists a bunch of files and directories which offer no help.
ERROR MESSAGE SNIPPET:
CompileSwift normal arm64 (in target 'App Name' from project 'App Name')
...Lists a bunch of directories
error: Illegal instruction: 4 (in target 'App Name' from project 'App Name')
The weird thing is that prior to the XCode and MacOS update, this app will Archive fine. So I am left to assume something was deprecated in this latest release.
My question is: What are some debugging tools to help me start to find where in my code this may be happening? Why would the app build and run fine on simulators and devices but not Archive? makes no sense to me.
I did test this by attempting to Archive on another MacBook with MacOS 11.0.1 and XCode 12.2, and it Archives fine.. Although, this is really useless since you cant upload a binary compiled with an older version of XCode.. *I was able to upload the binary using the older Xcode version, not sure if it will let me release this, but I will try that for now.
I have considered deleting and reinstalling XCode, but I don't know if that would be a waste of time. Maybe something didn't update properly?
At a loss. Any insight is appreciated.
update
When I edit the scheme and change Archive from Release to Debug, it Archive's?!
What am I missing?
2nd update:
When changing the build settings, under the Project, Swift Compilier, Code Generation, Optimization level from Optimize for Speed -O to No Optimization -Onone, the app Archives with no issues.

Xcode 8 Cordova.h file not found

Using Xcode 8 and the beta for Server (5.4). Trying to get automated builds to work but keep getting Error 'Cordova/CDVPlugin.h' file not found. This only happens when archiving from a bot. If i archive from the build machine just through Xcode, it archives fine. There was a similar issue when Xcode 7 came out that required a change to the header search paths. Anyone have a solution to this yet?
Xcode 7 Cordova Issue
Try cordova platform update ios but be careful, for some reason it messes up cordova plugin accessibility somehow.
This worked for me in Xcode 8.3.3:
go to Build Settings
find Search Paths > Framework Search Paths
add the path to where your exact Cordova library is stored on the current machine; make sure it's Cordova/Frameworks if your actual path (in Finder) has the Cordova.framework package nested in a /Frameworks sub folder
Clean
Build / Run again

Xcode 7 or 8 issue with Pods, can't run at all

Getting this error for pods in Xcode when trying to run app:
error: A cryptographic verification failure has occurred.
Tried reinstalling Pods/repo
Reinstalling Xcode(s)
Also doesn't run on simulators:
Also, running Sierra at the moment (yes, I know).
This is a regression in macOS Sierra that multiple developers have reported in the forums and in the lab sessions at WWDC. Xcode 7.3 is not officially supported on Sierra. If you want to use macOS Sierra, please use Xcode 8.0 beta or later.
If you must use Xcode 7.3 on Sierra, you can partially workaround this bug by using Xcode.app to install the app through Build & Run, launch the app suspended from the command line (xcrun simctl launch -w booted <app identifier>) and then attach with the debugger and resume the suspended process.
Note that this issue only impact Xcode 7.3.1 downloaded from the Mac App Store. You will not hit this issue if you use Xcode downloaded from http://developer.apple.com (ie, the "drag & drop installer"). Note that you might hit another issue with the same symptoms when using the drag & drop installer. That is discussed in DTAssetProviderService could not start DTXConnection with Simulator
I got mine working now!! Not really sure what I did, at all, but I just deleted the Xcode 8 .app entirely and then I redownloaded it, opened up my project in it, did a pod install and pod update, and it's running in the simulator just like normal! Not sure what I did at all, but redownloading is worth a try, it is in fact possible to fix.
If you have reinstalled CocoaPods so that it updated from a version that is lower than 1.0.0 to 1.0.0 or above it can't hurt to delete your DerivedData folder of the project that is having problems. I don't know why it fixes a lot of bugs when above scenario is the case, but it does! You can do this by going to: Window -> Projects
Then select your project on the left (It was my "Piece" project for me)
Then click the delete button
Hope this helps you out!
Launch "Keychain Access", go to "Preferences..." and click "Reset My Default Keychain". After that I was finally able to build my projects.

How can I add older version of iOS SDK in Xcode 4.5

I copied the iOS 5.1 SDK here:
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
But, I still can't choose the base SDK in Xcode.
Can anybody help?
You need to copy the iPhoneOS5.1.sdk to the directory
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
and iPhoneSimulator5.1.sdk to
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
(You'll need to restart Xcode to be able to select the SDKs in the Base SDK build option.)
None of the above worked on my 10.8 xcode 4.5.1.
Most of the paths given above are not found.
Here is my solution note.
Download xcode_4.4.1_6938145.dmg in https://developer.apple.com/downloads/
Load up the dmg file then go to Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ you will find iPhoneOS5.1.sdk (this is what i want in this case).
Copy iPhoneOS5.1.sdk folder into your Xcode folder /Applications/Xcode/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
Restart Xcode
Open Xcode project setting->build settings->base SDK, then you will see iOS 5.1 option.
From the terminal, run this command, then restart XCode:
cp -r /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Note, substitute 'iPhoneOS5.0.sdk' with the name of whatever SDK you're interested in copying.
#benvolioT answer is correct, but you need permission:
sudo cp -r /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Old SDK's for the OS and Simulator might be available from these locations using finder.
For OS
/Developer-old/Platforms/iPhoneOS.platform/Developer/SDKs
For Simulator
/Developer-old/Platforms/iPhoneSimulator.platform/Developer/SDKs
Developer-old, you would find it in device volume path.
Akhildas' solution worked for me. I was able to build against the 5.1 SDK with XCode 4.5.1. One caveat:
If you drop an SDK from a version of XCode downloaded by a different Apple ID, the App Store will show that you have an update to 4.5.1 (even though you already have it). When you press the update button, it tells you to log in with the other Apple ID.
Strange, I wonder where the account information is buried in the 5.1 SDK?
Also, when I set a base SDK back to iOS 6, it appears you have to restart XCode to recognize that framework.
xcode.app > Right Click > Show Package Contents
It will open xcode package contents.
Go to the directory path -
Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
Now you can see the folder name with ios sdk version. For example : iPhoneOS(sdk-version).sdk
The BEST SOLUTION is to go to the XCode Preferences and to install older versions of iOS simulator / SDK from there, as explained here : https://apple.stackexchange.com/questions/47323/installing-xcode-with-ios-4-3-device-simulator
Hope this helps :)

Adding Older iOS SDKs to Xcode 4.1 in Lion

I just installed Lion and Xcode 4.1. How do I add older SDKs so I can build and run in 4.1 or 4.2 in iPhone/iPad Simulator? Xcode 4.1 only comes with the iOS 4.3 SDK.
Does Lion have some sort of minimum SDK for builds?
Thanks,
Actually it is possible to add older SDKs as long as you can still get your hands on an older version of Xcode with the older SDK. It's useful too sometimes: when you do this you get to find out about unsupported constants and methods you may be using during compile rather than at runtime. Here's how to do it.
Get hold of an older version of Xcode with the older SDK. The Apple iOS Dev Center currently lists the 4.3 SDK with the Xcode 3.2.6 download.
Mount the dmg and open up the Packages folder hidden within the dmg via Terminal:
open /Volumes/Xcode\ and\ iOS\ SDK/Packages/
Double click the pkg file for the SDK version you want. I was looking for iPhoneSDK4_3.pkg but, in addition to 4.3, found packages as old as iPhoneSDK3_0.pkg. So perhaps older SDKs may still be packaged with the App Store download if you know where to find it (I didn't).
Let it install in it's own folder of choice since you won't be able to force it to install in Applications/Xcode.app/Contents/Developer (which is where the Developer folder is now)
You'll find the package installed in the Platforms folder in the volume you chose. Move the relevant SDK over to the Developer folder within Xcode.app. You'll likely have to use sudo:
sudo mv /Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Restart Xcode and you should see the new (old) SDK listed in your options for Base SDK. Yay!
Update as of 12 Sep 2013
If the "older SDK" you're trying to add comes bundled in Xcode 4.3 or later, adding the SDK is as simple as downloading Xcode from dev center link that says "Looking for an older version of Xcode?" (currently points here), mounting the dmg, then copying the relevant files over.
In terminal, you'd do something like this (edit for the appropriate SDK version number):
cp -R /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
For SDKs from versions of Xcode prior to 4.3, the older steps are still relevant.
I found this happens to work for getting the Xcode 5 GM to compile builds that carry the old iOS 6 UI even when deployed on iOS 7 devices. Useful for fixing bugs pending a UI redesign. That said, there's got to be an easier way to get the iOS 6 UI on an iOS 7 device.
You can't. What you can do, however, is click on the top-level entry in the File Navigator. It'll take you to the application settings. Go to the tab called Build Settings, and change the iOS Deployment Target to whatever version of iOS you'd like to support from (the earliest version you support).
See "To Edit a Build Setting…": http://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Building/Building.html#//apple_ref/doc/uid/TP40010215-CH9-SW5
Open Xcode and open Preferences (Xcode -> Preferences menu). Click the Downloads icon and look in the Components tab. All versions from 3.0 to 5.1 should be available. Just click Install for the ones you want to use.
None of these answers worked for me for Mac OS 10.8 and XCode 4.5. But now that things are installed under the Applications folder, it's much easier to manage.
Option #1: Keeping an older copy of XCode is easy to do by renaming it before you install the new one. Then you can use Product->Preform Action->Run Without Building on the new version to test on newer devices or newer simulators.
Option #2: If you REALLY want to build with older SDKs in the newer XCode, then you can simply copy over an SDK using finder. You'll need to have an older version of XCode installed under Applications for this to work. In the following example, I just renamed XCode 4.4 to XCode_old before I installed XCode 4.5. Note: You can right click on the .app file and choose Show Contents to get to these files or just use the cp from a terminal window.
from: /Applications/Xcode_old.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
to: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Then, iOS 5.1 will show up under Build Settings as a Bask SDK. You can do the same thing for simulators:
from: /Applications/Xcode_old.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
to: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
You can't, but it will build fine for a device that is plugged in running an old version of iOS (what you should be conducting your proper testing on).
You have to run your application in the older version of Xcode that came coupled with the older iOS version. I have 3.2.5 installed under /Developer-3.2.5/. I have to say it's about 10 times faster than Xcode 4... You can download old versions here: http://iphonesdkdev.blogspot.com/2010/04/old-versions-of-iphone-sdk.html
I had a similar issue in Xcode 4.02 for Snow Leopard using SDK 4.3. I wanted to test on an iPhone 3G, but iOS4.2 is the latest (and correct version) for that device. In order to 'see' and run on that device in the Scheme, I had to change the Build Settings for iOS Deployment Target as described above. (btw you also have to have restrictions on the iPhone turned off to let Xcode install the app :) )
In addition to Steven's answer, you can find older versions of XCode - including the older SDKs:
Looking for an older version of Xcode?

Resources