Xcode IDE crashes when performing any action - ios

I can launch an Xcode project, but the second I try to do anything, e.g. toggle automatic signing, link a library, even change the build number or ANYTHING, Xcode crashes. The only hint I get as to why is this error on "Xcode quit unexpectedly"
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[PBXFileReference realReference]: unrecognized selector sent to instance 0x7fbc8f52ee10
Something is corrupted. I thought it was related to the pbxproj file I don't know if that's the case. There are no merge conflicts. Does anybody have any clue as to what is happening? I want to rip my hair out but I'm bald.
Things I've tried:
Updating my system software
Deleting and reinstalling Xcode entirely
The status quo of deleted Derived Data and cleaning the project/builds
Note:
Other Xcode projects are launching fine and I am able to navigate the
IDE. It's only this project.
It seems to be Xcode version agnostic. So far I've confirmed it crashes when changing anything on Xcode 9.4.1 and 8.3.3.
I can provide additional context around the project upon request.

Related

Xcode 13.3 Not Linking Storyboards

I have a project that builds and runs with no issues when using Xcode 13.0. However, if I close 13.0, and try to then build and run the project using Xcode 13.3, the app will build, but then crash immediately on launch with the following error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle
I'm making no changes in the project at all - the only change being the version of Xcode used to build the app. When comparing the build output between the two versions of Xcode, I have noticed that 13.3 is skipping the "Link Storyboards" step.
A few things that I've tried include:
Removing the storyboard file from the .xcodeproj, and re-adding it.
Removing all localization from the project, thinking it may be related to that. I then tried re-enabling localization.
Creating a brand-new storyboard using the File > New> Fileā€¦ menu. Even the new .storyboard files are not linked or added to the project.
Removing and then re-adding the .storyboard files to the Copy Bundle Resources build phase.
Bumped the minimum deployment target from iOS 13.0 to 14.0
Cloned my source code from Git to a new location and built from there.
Product > Clean Build Folder and manually deleted the derived data folder locations more times than I can count. I'm using the default Derived Data location. (~/Library/Developer/Xcode/DerivedData)
I've been able to verify that the storyboard files are not being included in the finished app by inspecting the .app bundle after the build succeeds. All other resources I've been copying to the app are there, but the storyboards are not.
Has anyone else seen this issue, and if so, resolved it? I've been stumped for a few days now, and so far, the only thing that's worked has been rolling back to Xcode 13.0.
Fixed it. Turns out that a few years ago, a User-Defined build setting for CONFIGURATION_TEMP_DIR had been defined in our project. Removing this setting, and falling back to the default value got our project running again with no issues. I'm not sure why this setting had been defined originally, but apparently Xcode 13.3 just doesn't like it anymore.
This line also affected another project of ours, that doesn't use storyboards, but does have an Apple Watch app. In that case, the crash was similar, with the error stating that an Interface.plist file could not be found.
Apple's (archived) doc on the setting.

Xamarin iOS app crashes with +[MSAppDelegateForwarder addAppDelegateSelectorToSwizzle:]: unrecognized selector sent to class

I am trying to get an existing Xamarin native iOS app using MvvmCross to build and deploy but it crashes on every startup with
+ "[MSAppDelegateForwarder addAppDelegateSelectorToSwizzle:]: unrecognized selector sent to class"
Searching around on "MSAppDelegateForwarder addAppDelegateSelectorToSwizzle" I see a lot of references to the Microsoft App Center project. I have disabled App Center in the app and uninstalled the packages but am still getting this error.
I have also discovered that I am getting this error logged on build
Class MSService is implemented in both /System/Library/PrivateFrameworks/MailServices.framework/MailServices (0x2718caf70) and /var/containers/Bundle/Application/3FDD6329-9949-4E57-8CA1-7E295EABC7F0/(MyApp).iOS.app/(MyApp).iOS (0x106c54118). One of the two will be used. Which one is undefined.
I have cleaned, rebuilt, deleted bin and obj files, deleted the packages file and even removed and reinstalled Visual Studio Mac. I am not sure where to go from here. Has anyone run into this exception before?

Migrating SceneKit app from xc10 > xc11, I encounter "xcrun: error: unable to find utility "scntool", not a developer tool or in PATH"

Due to character limits in the title, allow me to elaborate on what is happening.
I have an application that builds with no warnings & errors while using Xcode 10.2.1, but I would like to test it in the latest Xcode 11 beta.
However, it produces an error during the build process, yet oddly enough, the app properly launches and is usable on a simulator.
The error:
xcrun: error: unable to find utility "scntool", not a developer tool
or in PATH
Initially, I thought it was possible that the spaces in my app's name were a problem, so I quickly renamed it to use _ in place of the spaces, but that did not work.
Rebuilding the app after I removed the spaces also shows the following warning:
copySceneKitAssets: warning: Failed to copy SceneKit assests because
scntool failed to process the following resources:
/Users/someidiot/Library/Developer/Xcode/DerivedData/Build/MyAmazingApp/Products/Debug-iphonesimulator/My_Amazing_App.app/art.scnassets/Game.scn
And yes, the file is there:
Out of curiosity, I purged my derived data in case something was causing problems there.
rm -rf ~/Library/Developer/Xcode/DerivedData
However, the same scenario as before... warnings & errors upon building, but the app successfully launches on the simulator.
My concern here is that if something is genuinely wrong, I'd like to fix it before it becomes an issue, but at the same time, the app does launch successfully.
Unfortunately, I do not have access to an iOS 13 device at this time to test on hardware.
After any new Xcode installation, or even when switching between versions of Xcode, always go into Xcode's Preferences and, under Locations, adjust the Command Line Tools pop-up menu to point to the version of Xcode you are using.
Otherwise, something like xcrun, which means "run a tool inside Xcode", will be looking in the wrong Xcode.

Archive validation failed due to -[__NSArrayM objectForKey:]: unrecognized selector sent to instance

The above is the screen capture.
Running on iphone is good. But when goes to archive, the validation failed.
If I do have this kind of error in my code, it will appears when compiling. Is that right?
I tried cleaning the project and archive again. It show the same error with different instance address.
That looks like one of Apple's tools in the broad and opaque Validation & Upload toolchain has crashed! How strange!
This is what I would do:
Cmd+Option+Shift+K to clean the build folder (a pointless religious practice)
Quit and restart Xcode.
In Project Info->General set Signing to None, and then set it back to your team's identifier (or whatever you're using to sign with).
Archive & Submit your application again.
Good luck! If it fails again, don't hesitate to submit a bug to bugreport.apple.com.

The application is missing required entitlement com.apple.developer.icloud-services'

I'm using a public iCloud database in my app, which works great and is up on the store.
On updating my app to a new version (with Xcode 7 on iOS9) I get a crash on the line :
CKContainer * container = [CKContainer containerWithIdentifier:#"iCloud.com.identifier"];
*** Terminating app due to uncaught exception 'CKException', reason: 'The application is missing required entitlement com.apple.developer.icloud-services'
This happens ONLY the first launch of the app after updating, and only on iOS9. After that first (update) launch, the app launches and iCloud works as expected.
I can recreate the crash consistently by downloading the current store version of the app, then running the updated app from Xcode 7.
If I do the same steps (download production app, and update) using iOS8, I do not have the same crash.
I'm guessing this is an iOS9 or Xcode 7 bug. Any ideas?
EDIT :
This actually happens on the first launch of the app on iOS9, regardless of whether I'm updating or just first installing.
Xcode 11.1
Make sure you have enabled it for both debug and release mode:
Toggling the iCloud Capability on and off seems to have fixed it.
Toggling iCloud didn't work for me. Reinstalling the app didn't work either. The problem seems to happen whenever I have break points enabled. If I turn these off it runs without any problem.
For me toggling the iCloud capability off/on was the way to fix it, due to after that in the entitlements file a new key is created: "APS Environment" and its value "production" or "deployment".
Changed the name of my app, therefore the entitlements file should have been different. Turning off and back on recreated the required file. Turning off breakpoints made it filter through (strange).
For me, I had Code Signing Entitlements designated for my Test target. So the app would build fine. But the unit tests would just quit no matter what. Clearing out the Code Signing Entitlements field from the Build Settings of the test target fixed the issue. After. Many. Hours.
After switching to a new version of Xcode I got this error. None of the other fixes worked. After looking closely I saw that the code signing identity had changed! When I put it back all worked.

Resources