App installation failed: Could not write to the device - ios

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.

Related

Xcode: Could not locate installed application. Install claimed to have succeeded, but application could not be found on device

I manually deleted my app from the iPhone and now I get this error message when trying to run it again from Xcode.
I cleaned the build folder, restarted the device, Xcode and the Mac, nothing helps.
I also tried everything that's mentioned here: Install claimed to have succeeded, but application could not be found on device
How do I force a re-installation?
As always, when the question is posted on SO, one finds a solution ;)
I edited the Scheme, setting the build configuration from debug to release and that installed the app again. Changed it back to debug and now it's running again as expected.
I ran into the same issue while testing a app on iOS 13 via XCode 11.0. Building via the legacy system solved it (File > Workspace Settings... > Build System > Legacy Build System).
Hope it helps
I had a similar issue after one of Carthage/XCode updates. It means iOS was not able to install app on the phone. XCode apparently is not able to provide this information directly. The first thing to do is open your phone console - go to Window/Devices and Simulators then select your device and click Open Console. In the console you can search for your app name what should provide you more detailed fail info. In my case it was sth like this:
Applications did fail to install: (
"<LSApplicationProxy: 0x118913b60> com.mydomain.myapp (null) <com.mydomain.myapp <INVALID >:0>"
) (appInfos: (null))
There was another console log few rows before flagging the problem:
0x16f4df000 -[MIExecutableBundle codeSigningInfoByValidatingResources:performingOnlineAuthorization:ignoringCachedSigningInfo:checkingTrustCacheIfApplicable:error:]: 789: Code signing identifier (org.alamofire.Alamofire.iphonesimulator) does not match bundle identifier (org.alamofire.Alamofire.iphoneos) for /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.E83T1l/extracted/myapp.app/Frameworks/Alamofire.framework
There was an issue with one of the frameworks Alamofire I'm using in the project. I changed bundle identifier of the project and build framework again what solved the problem.
Hope it helps!
In my case, the problem was an embedded framework that was not being signed. In the General tab of the project settings, setting the embed setting to 'Embed & Sign' did the trick.
In my case it was a problem with new Development certificate. It's created automatically after Xcode updated to 11 and may not be included in current provisioning profile.
I was facing similar issue in Xcode 11.1. I have fix this issue. Not sure about this solution that it will to work for all or not.
My device iOS version was older then the iOS Xcode target build version.
Steps:
I have put Xcode target Device to iPhone device OS version.
Delete derived data
Start xcode and open project
Clean the project and gererate build and install in device
Note: Please check your developer account, certificate validation and already registered device warning.
Hope this solution will help some peoples. Happy coding.
After trying everything here, for me the solution was to change my distribution profile to use the new Apple distribution certificate that covers all apple platforms. This should be compliant with xcode 11 (if you're not experiencing one of the other million problems since the "upgrade").
The cert change is mentioned here:
https://developer.apple.com/documentation/xcode_release_notes/xcode_11_release_notes
Cert creation instructions here:
https://help.apple.com/developer-account/#/devbfa00fef7
Once done, make sure the correct profile is selected in Signing & Capabilities, and 'Apple Distribution' is selected under Build Setting -> Signing for the appropriate build configurations
A solution that solved this issue for me was to check the signing team for my tests target. Selecting the same development team then meant that my app was able to be built and run on device.
Build system: New Build System
Xcode: Version 11.1
Uninstall all the other apps that are under the same "Organization" or "Bundle Identifier" with your current app and try again.
It works for me. Hope it does for you too.
On your iPhone go to Settings/General/Profiles & Devices/Apple Development: "YOUR APPLE ID" and delete all apps from there. It fixed the problem for me.
It happened to me when trying to launch a watchOS app on a real device.
The only solution that worked was:
Delete iOS app from device
Delete watchOS app from device
Close and reopen Xcode
Clean build folder
I did a Product -> Clean then Build, and it was able to run.
Go to settings on your phone and wipe out all certificates and apps and then install your app again. That helped me
Problem occured on XCode 11
TL;DR:
Try changing Embed option in General=>Section Frameworks, Libraries.. to Do Not Embed (although it sounds strange)
In my General=>Section Frameworks, Libraries.. list are Security.framework and the CocoaPods Pods_projectname.framework amongst others. Default setting of these two was Do Not Embed. Sounded strange to me, so I changed it without need alternating to Embed & Sign or Embed Without Signing. With both options the error occured!
On your iPhone go to Settings/General/Profiles & Devices/Apple Deelopment: "YOUR APPLE ID" and delete all apps from there. It fixed the problem for me.
This was the solution that worked for me.
Please double check the bundle ID of the installed application to see if it is re-applied, this will also cause this problem .I uninstall the app and solve the problem.
In my case i have PROD certificate and trying to install the app in the device, later i changed to development certificate it got installed.
As Marcin's answer suggested, I visited the phone console and in my case, it is this error message:
-[MIFreeProfileValidatedAppTracker _onQueue_addReferenceForApplicationIdentifier:bundle:error:]: 182: This device has reached the maximum number of installed apps using a free developer profile: {(
So if you are signing your app with a Personal Team certificate, make sure that you don't have more than 3 apps.
Read more here: Why can I not install more than three apps?
As for me,
I added a custom key-value to Info.plist of main watchOS application file. That was wrong.
After removing it, all works correctly.
It seems this is not allowed but where is no other information about it.
If you have other under-development apps installed, try uninstalling those you are not using, and run Xcode to install your app again. It works for me.

Xcode 9 App installation failed, Could not write to the device

I've just updated to Xcode 9 and am getting App installation failed Could not write to the device error popup every other time. I see there are older questions on the subject, but this one is particular to iOS 11 and Xcode 9. I've never had the issue before.
How do I make sure Xcode 9 can install app to device every time?
In my case this issue was caused by using App Store distribution certificate while iPad was connected wirelessly.
Switching to development certificate fixed the issue.
Xcode 9 seems to have many different manifestations of this problem. Some of the other answers address specific problems, but this definitely occurs when there is nothing wrong with your project. These steps always resolve for me (in order from least painful to most painful):
Try running it again. Sometimes it works on the 3rd or 4th time.
Unplug the device and plug it in again.
Restart Xcode.
Clean build folder (not a regular clean - this is cmd+option+shift+K or hold option in the product menu) and then rebuild.
If all else fails, once a full restart fixed it for me. But probable something else was the root cause.
Hopefully Xcode fixes these problems soon...but I'm not hopeful.
In my case, I want to testing watchOS app and I set the debug provisioning profile to release one. I set to automatic and the issue is gone.
The solution that works for Could not write to the device is clicking the run button again after dismissing this error message.
In some cases I get the error App installation failed: unknown error. In this case I need to do a clean before building.
Deleting the app from device also helps.
I had similar issue and got is solved using below steps :
Delete app from device
Disconnect device from system
Restart iPhone device and Xcode
Delete derived data content
Clean your project (Shortcut key : cmd + shift + k)
Rebuild your project
I am facing same issues on my iPad. It was working fine before. But after some time my development version stop working on iPad. I have tried and search on internet but not able to find solutions. I have tried all above cases but no Luck.
At last, I have found solutions. Some developer has changed DATE/TIME settings for my Ipad. Please check date/time because my Provisional profile for apps has expired for the manual date set on iPad.
Hope the following steps will be useful for others,
Check your provisioning profile is valid.
choose the debug profile for signing in target.
Open you scheme under product in menu toolbar or using Cmd + < shortcut.
Choose debug mode for Run in your product scheme.
Tadaa! now you can run the app in your device flawlessly.
Happy coding! :)
I tried all the method , they didn`t work for me .
And I fixed the problem by removing the soft link file made by ln -s
In my case, this issue appears when I added a folder as reference in the project which contains a symlink. Removing the symlink fixed the issue.
Mine occurred when I had not signed in using my itunes developer portal credentials to sign into XCode. When I did it and cleared all derived data, it worked out.
Everyone is solving this problem in a different way. Mine was changing executable name, building the app (throwing the "You don't have permission etc." problem) and changing the executable name back to the original value.
I don't know why but it worked.
I actually had to reboot the system on the Mac, this gets me rid of the problem for a good while, but it eventually comes back. None of the other solutions mentioned here worked for me.
In my case the problem appears while I use manual signing and try to debug the app in Release mode. Although the fastlane builds and uploads fine in this mode fine, direct XCode debugging fails with the error "Could not write to the device". Temp switching to automatic signing mode fixed this issue.
What worked for me:
delete the app from iPhone
clean the code in Xcode
quit Xcode
re-open Xcode, connect my iPhone, and run it again
I got this issue App installation failed - Could not write to the device and I solved it by doing the below steps
Uninstall the app from device.
Clean the project.
Run the project.
It worked for me.
Xcode 9. iOS 11 SDK. Watch SDK 4.x.x - OPEN THE WATCH APP on the iPhone after failed. My Watch tab->(scroll down to the bottom)-> Install your app. Hope this helps. Just need permissions from the "Watch" app.
I had the same question that could be solved by deleting other debug App from my iPhone, then it worked.
When I choose the Automatically manage signing, my problem fixed.Hope my answer can help you.
Sometimes the problem arises when you removing some pod file reference. The only way to solve this in also your pod-file
eg:
use_frameworks!
pod 'KYDrawerController'
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'Alamofire'
pod 'Firebase'
pod 'Firebase/Messaging'
remove the unwanted file in this place. And also reinstall the pod-file again and open your project it surely works for you.

Internal API error

Since few days, every time I try to run my app on my iPhone, I get get this error message "There was an internal API error".
I'm getting this error just with one application only on my iPhone. In fact, there's no problem with the same app on simulator or on my iPad. No problem too with other apps on my iPhone...
I've tried many things mentioned in those threads:
"There was an internal API error." while running an app on any iPhone/iPod-touch device
Xcode 4.4 - There was an internal API error
like remove/re-run the app, reboot iPhone/mac, clear cache, check plist, check profiles, check build settings, restore iPhone.
I'm using xCode 7.1.1 and iOS 7.1.2
Can someone point me on what I forget to check please ?
As per my work and research I got a solution. Since I was preparing the build in manual way from product. In that case my appname.app was copying in folder from which I have to create a build, that app was not copied properly and I prepared the build and installed in my device, in that case I got this error.
I again clean the Xcode prepare the build properly and installed it, it works.
When I rename my project and delete the special character "ç", xCode success to run the app on my iPhone. It might be related to xCode 7, before there was no problem for compiling.
I also had this problem. The way I solved it was by removing the special characters from the Product Name (in Build Settings) - I had an 'æ'. Indeed, it looks related to Xcode 7, because it used to work on previous versions of Xcode.

Installation Failed: Invalid Argument -iOS Extension

https://imgur.com/vFn0S7g
I am about to build watch app target from existing project. I encountered a strange error upon finishing build that unables me to run the watch app properly. Here is the attached screenshot.
Environment
OSX 10.10
XCode 6.2 Beta
Simulator iPhone 6 iOS 8.2
When I try creating new watch app project and try the Lister demo app they work just fine. So I am suspecting there is something wrong with my existing project but not sure what since the error message is not really explanatory. I appreciate any leads or helps given, thank you for your time.
EDIT: After few investigation turns out extensions do not work as well.
I had the same issue. This sequence helped for me:
Xcode doesn't like it when you have a referenced directory called
'Resources' within your resource bundle (see timrex)
1) Remove 'Resources' directory from your project's tree;
2) Reset content and settings in iPhone simulator;
3) Press Shift+Cmd+Alt+K and click 'Clean' or Shift+Cmd+K in xCode window;
Check if the Bundle Identifier isn't empty in the Info.plist
After 2 days of research I have found the answer which I believe is an xcode bug.
Basically this is caused by having different build name on your XCode build settings. Making them uniform should solve the problem. As shown here https://devforums.apple.com/message/1047770#1047770
I hope this helps anyone stumbled upon this question.
I got my error fixed by setting the project's "Product Bundle Identifier".
It was empty since my project was being generated by Gyp and I hadn't set that particular setting on the project.
I ran into the same issue and got it resolved by cleaning the phone's memory since it was too low to install the app.
This issue can be resolved simply by emptying the trash.
I fixed this by first building for an actual device - once I'd done that at least once, the simulator ran fine.
I got it working after I tried everything mentioned here, then deleting the app from the device and restarting XCode. Those two steps were mentioned here:
https://stackoverflow.com/a/28232381/1586277
I have no idea what combination of steps fixed it though.
I got this issue while running on simulator. I rebooted the system and the issue gone.
I just had the same issue. My fix was to delete the temporary project files in the derived data folder:
rm -R /Users/username/Library/Developer/Xcode/DerivedData/projectname
I had the same issue. This helped
https://forums.developer.apple.com/thread/7338
Check your connected device has enough storage space.
I had this issue when I tried to run in my iPhone. I cleared the storage by deleting couple of apps and tried to install again and then it works.
Check your device's storage.
I had this issue and deleting some apps was the only solution for me...
I could fix this problem by switching to a different simulator (iPhone6 instead of iPhone6s) in my case).
Switch OFF your Phone and ON.
Now install your app ,its works for me.
If you run in device then remove previous app . It will work .

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