Xcode won't run app on simulator - ios

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.

Related

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.

Xcode 9.3 and update to High Sierra: Instruments can't open *.tracetemplate files even after full reinstall

With the last update of Xcode to 9.3 running on High Sierra, I realized that Instruments is not working any more.
When I try to open it from inside Xcode using Open Developer Tool > Instruments, I can see the template chooser dialog but as soon I pick one, a dialog appears:
The document "Allocations.tracetemplate" could not be opened. Instruments cannot open files of this type.
Allocations.tracetemplate could not be handled because Instruments cannot open files of this type.
This happens with all templates.
I already tried to reinstall Xcode completely. Before I deleted all files like described here: How to Completely Uninstall Xcode and Clear All Settings
I also tried to use
sudo chmod a+rwxt /Library/Caches/com.apple.dt.instruments
(Xcode 6.3.2: Instruments keep asking for trace template?)
but this file does not exist on my computer.
I also installed Xcode 9.4 beta 1 but that didn't solve the issue either.
I also can't find these template files like Allocations.tracetemplate anywhere on my computer.
Any help would be very appreciated ;-)
I still had some old Developer Tools on the HD. Removed following things and it worked again:
~/Library/Application Support/Instruments
everything I found in /Developer/ vaguely attached to Instruments
especially "3.0/Instruments/
and the old Instruments.app
also defaults delete com.apple.dt.Instruments in Terminal

This app could not be installed at this time.Xcode 9.2

I have changed my application name and bundle identifier and now when i'm trying to run my app it is showing an error that This app could not be installed at this time . Why it is so? Why it isn't running the app?
I know the question has been answered but for others encountering the same issue I suggest following:
Check simulator logs, if its printing something useful. First, selecte simulator then from menu option open Debug -> Open System Logs.
Make sure only 1 simulator is running.
Delete the older version of app from the simulator.
If you importing a custom framework, make sure custom framework->bundle-id is not same as currentAppProject->bundle-id. If you are not sure then simply change the bundle-id of current project.
Also some of the simulators can be buggy -> Simply change the simulator, it may resolve the issue, for me changing the simulator worked.

Xcode will run app on simulator but not on device

I receive the following error when trying to run the app on my device.
error: failed to launch '/Users/michael/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/Word Processor.app/Word Processor' -- No such file or directory (/Users/michael/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/Word Processor.app/Word Processor)
The app runs fine in the simulator. When I try to debug on the device, it appears to copy the app (I can see the icon), but then stalls with the above message. Xcode says it is running the app on my iPod, but nothing is happening on my iPod.
When I click on the app, the app appears to launch, but seems to be missing resources.
Other projects of mine work properly. What setting do I need to change to make this work properly.? Looking at the error message, it seems to be looking in my mac for the app. But this doesn't make sense since I am trying to run it on my 4th gen iPod touch. I am using Xcode 4.3.1 and iOS 5.1
With Mountain Lion and the latest version of Xcode (4.4.4F250), none of the suggestions in this thread worked directly (clean, clean project, remove derived data folder, etc). This sequence did. From DhilipSiva:
Disconnect your device
Delete the app from your device
Quit Xcode (Don't just simply close the window, quit it)
Delete derived data folder rm -fr ~/Library/Developer/Xcode/DerivedData (console)
Start Xcode,connect device & run the project
I solve this by going to Targets-> Info -> Required Device capabilities and delete the option with armv7.
Hope this helps!
This is a recurring problem that many developers are having with the current version of Xcode. The temporary workaround has been consistently deleting the DerivedData folder.
You can add doing it to a build script or even make it a cron job:
rm -rf ~/Library/Developer/Xcode/DerivedData
Sad, but true.
For me restarting of Xcode, cleaning DerivedData and restaring device wasn't enough in most cases, until I had figured out that iTunes was also running, and after quitting iTunes everything worked fine!
So my steps now are simple:
1. Quit Xcode.
2. If iTunes is running, quit iTunes.
3. Reopen project.
No need to remove app from the device, clean project or restart/disconnect device.
I think that's because Xcode and iTunes use some common libraries (as you know, Xcode Installer always asks to quit iTunes on installing iOS SDK).
I also had this problem after changing from a lower XCode and iOS version to the current XCode and iOS version.
I fixed this problem by changing th iOS Depolyment Target to a lower version, since my Device is not updated to the latest iOS yet.
You can do this by clicking the project inside the Info tab.
Have you looked at the Developer Certs and Distribution Certs if you have. When running in debug mode from Xcode your will need your app assigned with the developer cert and not the distribution cert. The distribution certs do not allow for debugging.
This error will manifest whenever the device capabilities described in the Info.plist do not match those of the device.
In my case, I was requesting GPS support and location-services support and trying to test on an iPod touch.
I struggled with this problem for 2 days and went through all the posts, tried all the options including, restarting Xcode, device, deleting DerivedData folder etc.
Finally, the problem was with the Info.plist file. In my case, I had improper icon paths in the Info.plist file. I suggest you to archive the application and then validate it to get the exact problem in you case. Only when I did that, I was able to find the issue.
I solved this problem many times with DhilipSiva's solution. However, it may not work sometimes. If that is the case, consider deleting and re-adding the target.
Removed armv6 support and it started working again
I stumbled upon this same problem on several diferent projects, researched a lot on forums and even here on Stack overflow. A lot of solutions were given, and some people seemed to get them working, but none of them worked for me.
So we tried some pretty obvious course of action, which for some reason we didn't tought about before: I've done a CHMOD -R 777 on the EXACT path indicated by the error message (I copied it directly).
Worked like a charm, 100% times!
Hope it helps, guys!
As Chronos mentiod, the device capabilities might be the reason. In addition I would say that in my case it was all about the UIRequiresPersistentWiFi key, which (for some unclear reason) didn't let me to install my app on an iPhone4. Hope this helps ones who tried everything else and haven't fixed the problem yet.
I solve this by going to Targets-> Info -> Required Device capabilities and check id at 0 index if armv7 not in 0 index then remove other things and armv7 set on 0 index and clean app connect device and run.
Hope this helps fine!
I did these steps:
Delete derived data: rm -rf ~/Library/Developer/Xcode/DerivedData
Deep cleaned the project: Shift Key + Option Key + Command Key + letter K key
Quit the project
Quit XCode
Deleted the app from my device
When I reopened the Xcode, launched the project, and then launched the app it successively ran on my device
For me it was Command Line Tools
Go to Xcode -> Preferences -> Locations -> Command Line Tools
Make sure you select latest Xcode version. I selected Xcode 11.0, and everything started working.
I get the similar question and has searched via the internet the whole day without solution yet...
Xcode 12, iOS 14.
I'm using a cocoaPods call GCDWebServer, which will open a build-in http service in iOS. Now it works fine in simulator and I could open a home page of it in my Mac's browser. But I cannot open the home page if running it with real iPhone. The browser said "Cannot connect to server"
And in console, everything is same without any errors provided for me.
Thus, how could I debug this?
[DEBUG] Did open IPv4 listening socket 3
[DEBUG] Did open IPv6 listening socket 4
[INFO] GCDWebUploader started on port 80 and reachable at http://192.168.1.3/

iPad2 device build does not update when I do a new build

I am having a consistent problem with multiple different apps that the build on the device does not update when I make code changes. Here's my set up:
OSX Lion
Xcode 4.1
iOS 4.3.5
I build, and then run, the app launches on the device but it still runs the last installed version. In order to get the build to update, I have to do the following...
Remove the app from the device (press and hold on the icon, and click the x)
Clean and then build in Xcode
At this point if I try and run the app does not run. Xcode log says the app has started and stopped. If I restart Xcode and run, then the app runs successfully and is the updated version
If I make a single line of code change I have to go through all the steps above to get the app to update. The project is very large so a clean build takes 2-3 minutes.
Any ideas?
Update
I found the solution, this is related to the use of static libraries. The following article helped me solve this:
Changing the source of a static library needs clean and build in xcode 4
and for general background this was very helpful too:
http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/
Double check your provisioning files and targets. Be extra sure to check the App ID in your targets, and Bundle ID in info.plist. Did you change any of that info before you saw this problem? I've noticed strange behavior like what you mentioned when updating those specific pieces of data.
Command+Shift+K -- Clean. I have found that you have to do a manual clean every time now to ensure that the build updates correctly.
In the event that xCode does not run at all, you just have to restart xCode.

Resources