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

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.

Related

Xcode iOS project: What is the meaning of "fopen failed" and "Invalidating cache..." at start of console log when running debug build?

I have an iOS app project in Xcode 12. It is set up as an iPhone-only app that supports iOS 12.4 and later. It uses the CoreData and PDFKit frameworks, as well as two proprietary Swift Packages. All of the source code is Swift.
When I run a debug build of the app, in a simulator or on a physical iPhone device, I always get the following lines at the start of the console log:
2020-11-20 13:14:52.785201-0700 [name of my app] fopen failed for data file: errno = 2 (No such file or directory)
2020-11-20 13:14:52.785318-0700 [name of my app] Errors found! Invalidating cache...
2020-11-20 13:14:52.895737-0700 [name of my app] fopen failed for data file: errno = 2 (No such file or directory)
2020-11-20 13:14:52.895847-0700 [name of my app] Errors found! Invalidating cache...
These lines don't seem to affect the app's functionality adversely, but I am wondering what they mean and where they are coming from. I have seen the same lines in console logs in other questions posted to the Internet, but have never seen a question where someone was asking specifically about the meaning of the lines (the questions were always asking about some other problem, and their log just happened to have these lines in it).
I had the same error when I ran Flutter-generated app on 'iOS module in Xcode' from Android Studio SDK. My errors are cleared up after I ran 'Product' -> 'Clean Build Folder' in Xcode.
My set ups are: Catalina 10.15.7, Android Studio 4.0, Flutter 2.01,and Xcode 12.4.
Metal is one possible culprit. If you're importing Metal, try omitting it to see if the error goes away. Also, edit your scheme diagnostics (command<, then click the Diagnostics tab) and deselect Metal API Validation if it's selected.
Not certain about the cause, but it looks like in some situations Metal tries to read a file from the Caches directory before it exists. In that case, the error should only appear the first time you run your app.
Regardless, I believe that it's safe to ignore this error, but check your Target Build Settings for MTL_ENABLE_DEBUG_INFO and make sure Release is set to "NO".
If none of this applies to your situation, try stepping through your code while watching your app Caches directory to see which frameworks are using it.

Xcode won't run app on simulator

Yesterday I uninstalled my App Store install of XCode and installed it manually from the Apple developer site.
I had 9.4.1 and downloaded 9.3
Ever since I've not been able to run any apps on the simulator.
I see the following error in xcode:
I see this error in the Xcode logs:
iOSSimulator: 56E6A4AD-4D6F-4CB4-A666-E1DE0D49B101: Failed to launch app with identifier: com.mikevelu.Test and options: {
"activate_suspended" = 0;
arguments = (
);
environment = {
"DYLD_FRAMEWORK_PATH" = "/Users/mikemurray/Library/Developer/Xcode/DerivedData/Test-fqvnwaelkrhrooepamzxmakiidkf/Build/Products/Debug-iphonesimulator";
"DYLD_INSERT_LIBRARIES" = "/Applications/Xcode9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode9.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Develope<…>
and I see this error in the simulator logs:
(UIKitApplication:com.mikevelu.Test[0xf61e][2808][2983]): Service could not initialize: 99Z999: xpcproxy_sim + 9282 [1524][AF02A7E2-099C-3F21-AB91-5AA7DB3FFA58]: 0x5
I've tried the usual culprits, removing derived data/cleaning build folder/restarting simulator/restarting xcode/restarting macbook.
I've also tried completely uninstalling xcode and reinstalling (uninstalled 9.3 and tried installing 9.4.1), doesn't seem to make any difference.
Seen a few similar questions posted and one of the most common fixes seems to be removing any checked blank environment variables in the scheme, I can't find any to remove. I've tried running both in debug and release, I've tried disabling Debug executable and selecting the executable on launch. Also tried deleting the scheme and creating a new one.
Also set verbose logging on the simulator and I didn't get any more illuminating information.
If if install the app manually using simctl and launch it using simctl it will launch without complaints (that's what prompted me to try disabling debug executable).
I see this issue regardless of which project/workspace I have open in Xcode, the example I'm using currently is just a blank project I created to try and get to the bottom of the issue.
I'm edging closer and closer to a complete restore being the most logical next step, but I'd like to avoid that if possible.
*EDIT - Discovered the issue was with anti virus not liking it when xcode wasn't named Xcode.app. Sigh.
So, it looks like renaming the Xcode.app file now leads to some pretty ropey behaviour.
Up till now when managing multiple installs of xcode I'd just rename the files to something like Xcode.9.4.1.app, not sure when/if that's changed but the only way I can fix the simulator issue is to keep the Xcode.app filename.

Xcode iOS app crash on launch: unable to create lldb_private::Process

I've been trying to get my OpenFL game to build for days, and finally got to the point where the build succeeds (had a lot of trouble linking everything correctly, using severla static libraries of different shapes and forms). It finally builds, and now I Get this:
How can I debug this? In the console it just says
error: failed to launch
'/Users/joon/Library/Developer/Xcode/DerivedData/TryHarder-cynkhfxgstydmgawfivgqqiluryl/Build/Products/Debug-iphoneos/TryHarder.app/TryHarder'
-- unable to create lldb_private::Process
I have rebooted computer, mobilde device, cleaned, rebuilt, uninstalled, which is what many sources recommend in the case of an on-launch crash with no info. Nothing does the trick however. Some sources recommend to set debugger to GDB, which is no longer possible in XCode 6 it seems.
I'm not sure how to debug this any further.
I began to get this when I changed Mach-O type to "Bundle" in Targets > build settings > Linking. I won't claim to know much about this, but perhaps it will help..
Set the Mach-O type to Executable and it will work absolutely fine. you can find it in Targets > build settings > Linking

XCode:4.6 Lion:10.8 IOS 6.1 error: SBTarget is invalid

XCode:4.6 Lion:10.8 IOS 6.1 error: SBTarget is invalid , how to solve this?
After hundreds of times testing, I find a way that can help the programme run,
here is it:
When you first meet SBTarget is invalid, choose Product --> Clean
Run again, this time you may also get error: SBTarget is invalid, it doesn't matter.
Turn off the XCode totally, 'totally' means that the Xcode icon should not appear in the Dock.
Double click your project file(xxx.xcodeproj , the blue one) to start Xcode, run again. (Do not Clean this time), and it runs ok.
Let me know if this can help you or you have any other methods. Thx
I had this issue while incorporating the Facebook SDK into my app. The error would alternate between SBTarget is invalid and telling me that my architecture was incompatible with my device so it would not launch. If I followed alexqinbj's advice it would run the app once but then it would go right back to having the same error again. I tried messing with architectures and build settings and removing derived data but in the end it really was just a duplicate file in my file structure. Facebook told me to add their SDK and then to add a folder (that the SDK file already contains). Once I saw that it was just a matter of removing the duplicate file. I've heard of this error happening with duplicate plists as well. Good luck
Indeed, the root cause (in Facebook integration) is the duplicate resources in the Facebook SDK (as per their instructions). When I deleted the resource files (remove references only), this problem went away permanently. Not sure why Facebook instructions ask you to drag the resources bundle over to the Facebook SDK framework you just brought in...
TARGETS -> Build Phases, remove info.plist from Copy Bundle Resources. Clean and run. It works for me.
Unfortunately, the accepted answer didn't work for me. I can provoke this error with 100% certainty. It is not necessarily an internal consistency issue with XCode that can be resolved through cleaning, rebooting and rebuilding.
SBTarget is Invalid is an internal XCode error. It happens when attaching a debugger and the architectures specified in the XCode project do not match up with the binary.
On OS X, you can diagnose this by going to the binary on the hard drive and typing:
lipo -info <bin>
Then comparing this to the build settings ARCH and ONLY_ACTIVE_ARCH. They must match. It is not enough for ARCH to be a subset of the possible architectures contained within the binary.
There are any number of reasons why they might not match up. Here are some suggestions:
You are using an external build scheme. XCode therefore does not dictate the contents of the binary. The build settings merely tell XCode what to expect when launching GDB or LLDB.
The executable specified for launch in the scheme is not correct. If it can't find the executable, the architectures will not be present.
This error has a very distinct cause in my case. Whenever "Expand Build Settings in Info.plist File" was set to "NO" in Xcode's "Build Settings", this message came up. Will submit rdar to Apple.

Xcode 4.4 No such file found launching executable

Before anyone just assumes what I am saying here, please read what I have to say.
I have read the hundreds of posts on this topic and have tried pretty much all the suggested resolutions, in no particular order:
Quitting Xcode
Deleting the derived data folder
Cleaning the project
Hard resetting iPhone
Resetting Mac
Tried a second iPhone
Different USB port
All these in 'special' order
Checked code signing attributes
"Validate Settings" returns no problems
Validation returns no problems
I am stumped when it comes to this. The only thing I can think of is actually resetting my phone, but don't see how this could help when it doesn't work on the second phone either.
Are there any other suggestions, tips, ideas on what could be causing this rather annoying bug?
UPDATE: The exact error:
Error launching remote program: No such file or directory (/Users/Username/Library/Developer/Xcode/DerivedData/ProjectName-dnfacjtdklqktcazrpfyupofdryp/Build/Products/Debug-iphoneos/ProjectName.app/ProjectName).
To get the error, I do any combination of the listed steps above, then click Run on "My Device" (an iPhone 4). Application never installs to the phone and Xcode reports the application has finished running then shows the above error.
My problem was cause by me accidently changing the "Deployment Target" (ios version) to a version higher than what was on the phone I tried to run the code on.
Change the deployment target to below or equal to the ios software version on your phone.
(this answer wasn't on your list) :)

Resources