Unable to run app in simulator - ios

Today, when I try to run my app in simulator, it simply tells me
Unable to run app in Simulator
An error was encountered while running
(Domain = NSPOSIXErrorDomain, Code = 22)
And the error dialog looks like this:
I've tried many things:
Restart Xcode
Restart Simulator
Reboot
Reset content and settings of simulator
None of above works. And I looked into log, I found these are those records has something to do with this issue
2014/10/15 9:09:40.964 com.apple.CoreSimulator.CoreSimulatorService[979]: Error Domain=com.apple.CoreSimulator.SimError Code=146 "Unable to lookup in current state: Shutdown" UserInfo=0x7f96c861d000 {NSLocalizedDescription=Unable to lookup in current state: Shutdown}
2014/10/15 9:09:40.964 Xcode[1983]: [MT] iPhoneSimulator: Unable to connect to "com.apple.instruments.deviceservice.lockdown" (Error Domain=com.apple.CoreSimulator.SimError Code=146 "Unable to lookup in current state: Shutdown" UserInfo=0x7fcf6fc24190 {NSLocalizedDescription=Unable to lookup in current state: Shutdown})
2014/10/15 9:09:40.980 com.apple.CoreSimulator.CoreSimulatorService[979]: Error Domain=com.apple.CoreSimulator.SimError Code=146 "Unable to lookup in current state: Shutdown" UserInfo=0x7f96c861d000 {NSLocalizedDescription=Unable to lookup in current state: Shutdown}
2014/10/15 9:09:42.351 launchd_sim[2047]: assertion failed: 13F34: libxpc.dylib + 29453 [75E30F22-514B-3A20-B82C-EDA43AF5C35C]: 0x8d
2014/10/15 9:09:42.362 com.apple.CoreSimulator.CoreSimulatorService[979]: Could not register service com.apple.coreservices.lsuseractivity.simulatorsupport: Failed to lookup com.apple.coreservices.lsuseractivity.simulatorsupport: 0x44e
I also found some other people had the same issue here : https://gist.github.com/bdeshong/2dd90add09b7287a9a85
No luck to find solution after Googling around.
Here is my environment information
OSX 10.9.5
Xcode 6.0.1
iOS Simulator 8.0 (550.1)
Any ideas?

I found the root causes, and I also found the solution. First thing I've done is to ensure this has something to do with Xcode rather than a problem relative to the project itself. I tried to create a new project, and it works perfectly fine. So I assume that is caused by something in my project.
I actually added a resources reference folder to my project. So I think the problem has something to do with it. However, even I removed the folder from project, the problem is still there. In the end, it turns out, the resources folder could live in
Built App folder
App folder in simulator
Since Xcode may simply copy and overwrite target App bundle folder, so the resources folder may still there in the App bundle folder. So after removing the resources folder, you need to
Ensure the build is cleaned
Ensure the app in simulator is deleted
And for the reason the App cannot be launched correctly, that's because it appears resources is actually a reserved folder name in the bundle structure. By adding a folder named resources into the bundle, somehow ruined the normal structure. To solve the problem, I changed the name from resources to app_data, or whatever it is, that all work.

I got the same. I just did force quit xcode and simulator then worked for me.

I got the exact same error. When browsing in my project info I inadvertently deleted the bundle identifier; hence the "ErrorDomain".
to correct, goto project data; info; set bundle identifier to whatever it was. it worked for me.

You are doing everything correct but Xcode and Swift are still in their early stages, means they are a little buggy right now. Maybe try restarting your Xcode and iOS Simulator once more.

This can happen for a couple of reasons:
You quit the iOS Simulator.app while Instruments was trying to use it.
You changed the booted device in the iOS Simulator.app while Instruments was trying to use another one.
If neither of those is the case, take a look at ~/Library/Logs/CoreSimulator/*.log for more information that might help debugging and include it in your question.

Root cause in my case was slightly different. In the project file, the iOS deployment target was set to 8.0 for the test target and 8.1 for the main target. We were running Xcode 6.0.1 (6A317) with 8.0 simulators on our build servers, which all started failing after the main build target was set to 8.1.
I'm not sure whether it was the fact that the target and tests were using different iOS deployment targets, or whether the 8.1 set in the project file conflicted with the 8.0 simulators, but it was this change which broke the simulators across several machines.
Unfortunately after setting the iOS Deployment Target back to 8.0 in the project, it still required a reinstall of Xcode (I also removed the ~/Library/Developer/Xcode directory) to return simulators to a functional state.

Check if you have proper permissions on your /private/tmp folder, should be writable and executable for all users.

Clear all files in
/Users/XXXXX/Library/Developer/CoreSimulator/Devices
Restart Xcode and Simulator.
Now it will work.

Related

XCTest, Failed to load test bundle. Crash on test launch

In Xcode 9.1, I added a Unit Test Target to an older project and I'm not able to get tests to run. The target crashes on launch with the following error in the console:
The bundle “XXXTests” couldn’t be loaded because it doesn’t contain a version for the current architecture*
Full output:
2017-11-15 11:52:40.973 XXX[54962:16511010] Failed to load test bundle from file:///Users/XXX/Library/Developer/Xcode/DerivedData/XXX-gaxtmzjadfkxzsdciqnpmyczgntj/Build/Products/DEV-iphonesimulator/XXX.app/PlugIns/XXXTests.xctest/: Error Domain=NSCocoaErrorDomain Code=3585 "dlopen_preflight(/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-gaxtmzjadfkxzsdciqnpmyczgntj/Build/Products/DEV-iphonesimulator/XXX.app/PlugIns/XXXTests.xctest/XXXTests): no suitable image found. Did find:
/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-gaxtmzjadfkxzsdciqnpmyczgntj/Build/Products/DEV-iphonesimulator/XXX.app/PlugIns/XXXTests.xctest/XXXTests: mach-o, but wrong architecture" UserInfo={NSLocalizedRecoverySuggestion=Try installing a universal version of the bundle., NSFilePath=/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-gaxtmzjadfkxzsdciqnpmyczgntj/Build/Products/DEV-iphonesimulator/XXX.app/PlugIns/XXXTests.xctest/XXXTests, NSLocalizedFailureReason=The bundle doesn’t contain a version for the current architecture., NSLocalizedDescription=The bundle “XXXTests” couldn’t be loaded because it doesn’t contain a version for the current architecture., NSDebugDescription=dlopen_preflight(/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-gaxtmzjadfkxzsdciqnpmyczgntj/Build/Products/DEV-iphonesimulator/XXX.app/PlugIns/XXXTests.xctest/XXXTests): no suitable image found. Did find:
/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-gaxtmzjadfkxzsdciqnpmyczgntj/Build/Products/DEV-iphonesimulator/XXX.app/PlugIns/XXXTests.xctest/XXXTests: mach-o, but wrong architecture, NSBundlePath=/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-gaxtmzjadfkxzsdciqnpmyczgntj/Build/Products/DEV-iphonesimulator/XXX.app/PlugIns/XXXTests.xctest}
(And then some diagnostic output that I didn't include)
Stuff I've checked after extensively googling:
Build Active Architecture Only setting is consistent across the app and test targets (With a value of Yes)
Enable Testability is set to Yes for the main target
I've deleted the target and started over, no luck
How do I fix this?
Make sure iOS Deployment target fields of your application target and test target are the same
I had the same issue. Simply building and running the associated application target on an iOS11.1 simulator (which happens to match the "iOS Deployment Target" of Test target) it started working.
It seems starting the test the first time did not trigger a build of the test host. Subsequent runs seem to trigger the builds as needed and all is good.
YMMV
It happened to me when updating the Xcode version from 9.3 to 10. In my case, deleted the DerivedData, then the unit test works.
I had the same error. And for me what it worked was the following:
Select your test on the PROJECT NAVIGATOR
on the right side, in FILE INSPECTOR choose the Target Membership, in this case your test target.
In my case, The Team under Signing & Capabilities were different for both Target Membership
making the Team same for all Target Membership solved the issue for me.
I had a similar error. My tests were passing locally but failing on CI (Xcode Cloud). The fix for me was to set Enable Hardened Runtime to No for Debug.
(from https://www.jessesquires.com/blog/2020/02/23/mac-app-tests-fail-with-hardened-runtime/)
In my case, I had Mac version of OCMock.frameworked in Link Binary with Libraries build phrase for an iOS project.
Removing it solved the issue for me.
run with another ios11 device solve the problem

Xcode 8 Beta (null) was unable to service the request

I have an app that worked fine in the released version of Xcode. I downloaded the beta and after I fixed all the little changes I ran it and it worked. I just came back and ran it again and I get an error saying
The request to open "com.matthewhsingleton.Smoke" failed . (null) was unable to service the request.
I have quit Xcode and reopened it, I have restarted my computer, tried different iPhone simulators and all produce the same resulte
My error was similar, instead of "(null)", the message was: "SpringBoard was unable to service the request"
Restarting the simulator worked for me.
After reading #Droppy suggestion I read the thread and it is a common issue. To solve it is as follows
Problem solved for by an Apple Engineer in the lab. It's an issue they're working on. The bottom line was that when I copied Xcode to Applications folder, there was a bit set on it and that was preventing it from communicating with the simulator.
To fix it:
Copy-paste Xcode-beta.app from Applications folder to somewhere else, e.g. Documents folder.
Delete Xcode-beta.app from Applications folder.
Move Xcode-beta.app from Documents to Applications folder again.
Seen here https://forums.developer.apple.com/message/143094#143094
I had 2 versions of Xcode installed. Xcode 7 and 8. I resolved this issue by setting the command line tools to Xcode 8 in preferences. Open preferences -> Locations -> Command Line tools. Set that to Xcode 8.

Simulator fails with (LaunchServicesError error 0.) [duplicate]

This question already has answers here:
Unable to run app in Simulator : An error was encountered while running (Domain = LaunchServicesError, Code = 0)
(19 answers)
Closed 5 years ago.
I received an error (Domain = LaunchServicesError, Code = 0) when trying to launch my app in the iOS Simulator with Xcode 6. I looked for solution in google, but I didn't find anything practical.
What does this error mean?
This error indicates that there was a problem with installation. Unfortunately, Xcode does not actually print the contents of the error message that would give you more insight, but you can look at ~/Library/Logs/CoreSimulator/CoreSimulator.log to see the rest of the error details. There will also be more information about the problem in the simulated device's system log (~/Library/Logs/CoreSimulator/[Device UDID]/system.log); look for messages from installd around the time of the error).
Common causes for this include bundles missing an Info.plist, missing keys within your bundle's Info.plist, or values for some keys in the Info.plist not being allowed.
If your app's Info.plist does not contain a valid CFBundleVersion key/value pair, it is possible that your app may install correctly the first time but fail to update. Many users seem to work around this by doing a "Reset Contents & Settings" after each install, but it would be better to fix the root cause by setting an appropriate CFBundleVersion in the Info.plist. I believe iOS 8.2 now correctly returns an error on the first install in this case rather than just on updates, so hopefully this problem will be more obvious now.
Users with home directories on file systems that do not support hard links (eg: network home directories via AFP, SMB, or some NFS servers) may also run into problems related to hard linking. If this is the case, I suggest you create a path on your local HFS+ filesystem for simulator development (eg: /var/simulator/[user]) and create a symlink to that path from ~/Library/Developer/CoreSimulator. This particular issue was fixed in one of the iOS 8.2 betas.
In another case, the Build&Run would always succeed on the first try, but subsequent attempts would sometimes fail due to a changed Info.plist (eg: because someone's build system settings result in CFBundleVersion being different on each iteration). You can usually recover by either deleting the installed app (using a long-press from the home screen or xcrun simctl uninstall [Device UDID] [app identifier]) or erasing the device back to a default state. To erase the device, execute xcrun simctl erase [Device UDID] from terminal or choose Erase Contents & Settings from the iOS Simulator menu. This particular issue was fixed in one of the iOS 8.2 betas.
A newer instance of this issue is occurring for Xcode 6.2 users. If you have a WatchKit App Extension bundled in your app, it will fail to install to versions of the iOS Simulator runtime older than iOS 8.2. As a workaround, you will need to manually disable the app extension from installing when you want to test with iOS 8.1 and earlier runtimes.
If you need more specific help, please provide the entirety of the error message from CoreSimulator.log and any messages from installd and CoreSimulatorBridge that appear around the same time in ~/Library/Logs/CoreSimulator/[Device UDID]/system.log as that will reveal the underlying problem.
Does your project include a widget or extension? If so, the problem could be the bundle identifier of your widget/extension. It should be the same as the main target, appended with a period and an extra string. So for example:
Main target: com.mycompany.myapp
Widget should be: com.mycompany.myapp.widget
I fixed it by resetting the simulator:
iOS Simulator > Reset Contents and Settings...
Since everyone writes what they went through and how they fixed their exact problem, that might be unhelpful.
The problem is that there are different causes for the same error message and the right way of solving it is to open up ~/Library/Logs/CoreSimulator/CoreSimulator.log and look in there for the last message. This message gives you a good clue and sets you on the right path of solving your problem (sometimes it's bundle IDs, sometimes it's a missing or an extra attribute in the Info.plist, but you always get a good, descriptive clue).
This is how you narrow down the problem and eventually get to fix it.
Good luck and tough nerves with Xcode .)
Z.
For me I just cleaned the project and it worked -> Product -> Clean
TLDR: Clear your Project Build Folder - and you will be free of this pain.
( plus I logged this as a bug with Apple as they need to find a way to fix this in Xcode )
None of these solutions worked for me - I banged my head against several walls.
I looked at the CoreSimulator log and I realised that it was trying to build a library that I had deleted.
I couldn't find references to it anywhere.
Then I saw via another SO Question which unfortunately I can't find to reference, if you:
Hold down your option key then Product-> Clean option becomes Clean
Build Folder
Press that and enjoy having your error vanish
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
In XCode 6
An error was encountered while running (Domain = LaunchServicesError,
Code = 0)
I had this error after making some major code changes to accommodate the iPhone 6 Screens. in Xcode 6 (iOS8)
I followed the options above and found that the only way to really get this fixed was by doing the following:
Deleted the derived data [go to Window >> Organizer >> (Find your App) Click on Delete next to the Derived Data]
Product >> Clean
Reset Contents and Settings in Simulator
Changed the Bundle Version to 1.4.1 from 1.4 in pList
Thank you for all the previous answers that got me to this stage. It worked a charm!
In my case, the error was caused because i didn't set the build id.
Setting this, launches the emulator without problem.
One other thing to try, that worked for me, after resetting the simulator and doing a clean build did not help, is clearing out the derived data. To do this: go to Organizer click on project click on delete derived data button. I had this happen after working on an extension for a while and went back to the regular branch. Hope this helps.
This is what caused the problem for me: the build number for the main app and the extension were different (I had incremented the main app build number to 1.0.1.03, but left the extension at 1.0.1.02).
Making them match fixed the problem for me.
Open the Console app and look there. In my case it told me exactly what to do. I saw:
ErrorDescription=WatchKit 2 app extension's NSExtension.NSExtensionAttributes.WKAppBundleIdentifier value does not match WatchKit app's bundle ID (found "com.myCompany.MyApp.MyApp.watchkitapp"; expected "com.myCompany.MyApp.watchkitapp").
So, I went to each plist and checked any items that related to a BundleID. Then Clean, relaunch, etc.
My case was about framework compilation. I have enabled the 'copy only when installing' option from Target- Build Phases- Embedded Frameworks-
I have an app that is set up to use different bundle IDs based on the build configuration. When creating my Apple Watch extension, Xcode generated everything using my Release ID, so I had to go through and change it all manually for debugging. Here's all the places I had to change it:
WatchKit Extension's Build Settings -> Packaging -> Product Bundle Identifier
WatchKit Extension's Info.plist -> NSExtension -> NSExtensionAttributes -> WKAppBundleIdentifier (this needs to use the same prefix as your companion app)
WatchKit App's Info.plist -> WKCompanionAppBundleIdentifier
The last one took me a while since the WatchKit App's Info doesn't show up as a tab when viewing the target settings, I had to go direct to the Info.plist file itself.
Try putting some number into [TARGETS]-[General]-[Identity]-[Version(or Build)], if they are empty.
It worked for me.
I hope it will help you.
I also have this error. In my case the log ~/Library/Logs/CoreSimulator/CoreSimulator.log was something like that :
Could not hardlink copy /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Containers/Bundle/Application/70F24DDC-7954-46BF-B799-F807FD98yyyy/myApp.app to /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Library/Caches/com.apple.mobile.installd.staging/temp.kOrJ9G/extracted/Payload/myApp.app with manifest /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Library/Caches/com.apple.mobile.installd.staging/temp.kOrJ9G/extracted/com.apple.deltainstallcommands.com.mycompagny.myapp
thanks to this answer In look at my app info.plist. the key CFBundleVersion was missing so I add it and now everything is working !
None of the above worked for me, but this did:
I simply deleted IceCream.xcworkspace/xcuserdata/xcuserdatad and then reset the simulator and ran the app again. (Reseting the simulator alone, did not work for me.)
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
The great explanation by Jeremy at least set me in the right direction, but despite having all the bundle identifiers and versions set correctly, the error still persisted. I then checked the Apple documentation which shows that the WatchKit extension (in its Copy Bundle Resources phase) copies the WatchKit app. This WatchKit app was named exactly the same as my iOS app, causing Xcode to confuse the two and read out the wrong plist, thinking the bundle identifier was incorrect. Renaming the Product of the WatchKit app to something distinct finally solved it for me.
If you've changed your bundle ID, make sure you do a clean build before trying to build it again! See how here: How to Empty Caches and Clean All Targets Xcode 4
So it's definitelly .plist problem. In my case it was empty NSExtensionMainStoryboard, removing this property fixed the problem
I had this error whilst trying to build Apple's Lister Xcode Project and run it on the simulator.
The essentials which fixed it for me were:
1) BundleID for the iOS App and the iOS Extension had to be different
2) I provide iCloud and App Groups for both targets
3) I used Xcode's "Fix Issue" to fix the issues
After that I could build and run the app without warnings or errors.
The clue from the log file was "... LegacyErrorString=DuplicateIdentifier, FunctionName=-[MIInstallableBundle performPreflightWithError:], SourceFileLine=450, NSLocalizedDescription=The parent bundle has the same identifier (com.ACMECompany.Lister) as sub-bundle at /Users/stephen/Library/Developer/CoreSimulator/Devices/5329928B-946B-40A4-B666-EFD11B96D11F/data/Library/Caches/com.apple.mobile.installd.staging/temp.HQ5d9X/extracted/Lister.app/PlugIns/Lister.appex"
Had a wrong app version set in InfoPlist.strings localization file. Urgh!
An hour gone!
Delete your simulator and regenerate one.
It works for me.
I removed the key in watch app's .plist file that shouldn't have been there. And the problem disappeared.
This worked for me:
In project settings -> General tab -> Identity section I changed the Version number from something like 2.0.2 (three digits) to 2.0 (two digits) then I deleted the app in the simulator and run the project again. No more error after that.
One other possible solution to add to all of the others that will no doubt stay above mine ;)
I deleted & later reinstated a Today Extension target retaining the source files, but after trying every solution under the sun, I realised it didn't have any sources or resources in its target! You might encounter this as well if your detailed launch services error can't find your compiled app extension file.
So, long story short, make sure your target has something included to compile or bundle in there. You can check your target memberships by selecting the relevant file(s) on your project navigator (on the left) and setting your checkmark(s) as appropriate in the file inspector (that's the first tab on the right).
I had the following in my log...
<Error>: Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=ExecutableTwiddleFailed...
This was due to there being no source files added in the extension project.
This error was showing up on my system when there was no hard disk space available. I freed up some space on my system for it to work.
My Problem was that the wrapper extension for the target project was unset.
To fix I had to go to target project -> build settings -> Packaging -> Wrapper Extension.
Set this to "app" (No quotes)
This fixed the problem for me

App installation failed: Could not write to the device

In Xcode 6.3, I got this error when trying to run an iOS project written in Swift on a real device.
App installation failed
could not write to the device.
I tried to clean the project and run again, but the same error occurs.
How can I fix this error?
Deleting the app on the device and running the project again works for me.
I did a Clean and installed my app successfully.
Product->Clean(Shift-Cmd-K)
I turned off the device and turned it on again after which I did not get such error.
OK, few things you should consider that could guide us to the problem, please check and post the answers:
is your project using capabilities? are they set correctly (should be all green)
did you try with a different project (something really simple)?
are you able to install apps from the App Store?
did you check the amount of free space left in the device?
if not, another suggestion will be using exception breakpoint, there is someone that posted an explanation how to setup it, do it and post the logs
App installation failed
I hope it helps you
Got this problem twice in one week on complete different devices.
One device had no more storage left, after deleting some apps the project installed perfectly.
The other device was fixed after rebooting the device
If you are using a free developer account you may need to uninstall some other apps you have signed.
For me it was the provisioning profile - I used distribution instead of development
My issue was an embedded framework.
Go to "Build Phases" -> "Embed Frameworks" -> Check "Copy only when installing", and it got rid of the issue for me.
For me the following did not work on iOS 11 beta 10, XCode 9 beta 6:
Restart the device
Deleting the app from the device
No symlinks were in the project
There was plenty of storage available
Deleted Derived Data and voilá, it worked again
in my project this problem happened because there was a folder with symbolic link. I removed that folder and it worked properly.
This error has many potential root causes, as can be seen by the large variety of suggested answers. The best approach to troubleshooting app installation issues like this one is usually to inspect the console of the iOS device itself, as that'll often provide much more specific error messages. In Xcode open the 'Devices and Simulators' window and take a peek at the logs of the device where your app is being installed.
In my case, the "Could not write to the device" error was being caused by this:
Feb 27 10:54:58 iPhone-7-110 installd(MobileSystemServices)[46] : 0x16f92f000 -[MIBundle _validateWithError:]: 38: Failed to load Info.plist from bundle at path /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.ebmR6U/extracted/SampleApp.app/Frameworks/SomeFramework.framework
Which clearly hints at what's actually going on. I had forgotten to set an Info.plist file for my dynamic framework target (used by the app).
I had a symlink in my project to a file outside of the project. When I deleted this symlink the install worked fine.
I was having the same error, i just deleted the project and fixed!
Go to Window -> Project and right click, and remove from projects!
In the case of your device have an app with the same bundle identifier, Xcode will throw this error.
Try to delete potential app with the same bundle identifier.
Check your provision profile, maybe you are using the app store provision profile like me. I had to change the app store provision profile to development, now it's working.
Tried all of the above answers: Deleting the app, clearing storage space, cleaning the project...
What finally worked was bumping the build number in info.plist (General > Build)
For anyone still facing this Issue:
There are so many reasons and this is one of them as it happened to me.
I've faced the same problem and I was connected wirelessly and If you are trying to install the application in wireless connecting mode (connected through same network), this might probably because of poor internet connection. Check your internet connection and try again, it works fine...
Get rid of embedded libraries, dont' just throw it in there make sure it is embedded indeed.
If you use your iPhone for debug, maybe, because your iPhone's storage space is less than your debug App.
Clean your iPhone --- Real machine
Clean your Mac --- Simulator
This looks like another time waster courtesy of Apple's amazingly high class development team. On iOS11 Xcode9 (pick your beta, any one works) this will happen randomly. Appears to be more frequent if you dare to switch apps while compiling. Just build again and stare at xcode - it'll work the second time without fail in my experience.
Apparently this message can also appear if the system clock of device where the app is being installed is too far away from the current time.
I was doing some tests with date formatters by changing my iPhone's system clock and eventually forgot to reset it to the current time. Afterwards it always displayed the same message ("could not write to the device.") whenever I attempted to run the app. Simply resetting the clock in Settings fixed the issue.
Nothing helped me. I followed the below steps,
Clean derived data folder
Quit Xcode and disconnect device
Restart Macbook
Restart Device
Open Xcode
Clean and run the project
Finally I got it working!!
I am facing same issue then solved out follow this step and now its working.
Deleting the app from the device
Try to install another application
Remove derived data in X-code.
Restart X-Code then clean and build the project then run.
It's still not working then
Remove un-used application
Restart the device and check the Available and capacity in settings
Again app run in device
I hope its worked, enjoy it.
My problem was I had initially installed the app using a different set of developer credentials on the device. Deleting the app from the device fixed it.
Maybe it can be due to the following error App installation failed. No code signature found. In my case after a project clean the description of the error switched to "No code signature found".
In my case I created two frameworks but they had the same bundle identifier.
This caused the installation to fail, so double check the frameworks bundle identifiers and make sure that each of them have a unique bundle identifier.
Environment: Xcode 10
sometime this error occurs due to wrong certificate.Please make sure your certificate.
Also this the error shown if your machine running Xcode is low on space.
Once I had to load an App Container for debugging purposes into an iPad, said operation failed because the container was too big (18 GB) for this device (16 GB minus the OS), so that I desisted the task and completly forgot about it, leaving the failed installation in the device. Later, when trying to install a different application this error appeared, once I got rid of the failed app installation, everything got back to normal.
Basically, your Ipad might be low in storage.
One reason this can happen is if your app bundle contains broken symlinks.

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/

Resources