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

17,653

Solution 1

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.

Solution 2

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.

Solution 3

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.

Solution 4

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.

Solution 5

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

Share:
17,653
Alex Stone
Author by

Alex Stone

When people asked me what I wanted to do for work 10 years ago, I did not know too well, so I just said "Something to do with computers". As I look at the last 10 years, I see that I did quite a lot of work all kinds of computers. From fiddling with microcontrollers and assembler code to writing data processing scripts to physically assembling computer consoles. The big step forward came when I learned to think about software in a structured, object-oriented way, as this allowed me to make software do things that I want it to do. Right now I'm proficient in two high level programming languages - Objective-C and Java and have touched just about every framework available for iOS. I've also became a hacker/maker and have completed a number of projects involving software and hardware. Right now I'm in my early 30s and when I ask myself "What would I like to do in the next 10 years?", my answer is "something with the human brain". The seeds are already there - I've picked up an interest in biology, cognitive science and neuroscience, enough to converse with real people. I've done first-hand research into sleep and made discoveries. I've taken classes in synthetic biology, performing manipulations on the bacteria genome. I've learned a lot about the neurotransmitter systems of the human brain, as well as how a biological organism develops. It seems like there are a lot of similarities between the object-oriented concepts I use in the daily programming tasks and how biological organisms operate. This makes me hopeful that by the time I'm in my late 30s, I would be able to work and program some form of biological computer or just plain hack the human brain.

Updated on June 06, 2022

Comments

  • Alex Stone
    Alex Stone about 2 years

    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.

    Screenshot

    How do I make sure Xcode 9 can install app to device every time?

  • David Seek
    David Seek almost 7 years
    code signing is set to automatic for me all the time, still this issue
  • Bill Chan
    Bill Chan almost 7 years
    May be you can try select the code signing identify manually?
  • David Seek
    David Seek almost 7 years
    Will try now. Also try to set from debug to release as you have mentioned. will let you know
  • Bill Chan
    Bill Chan over 6 years
    I encounter this issue again. Create a wildcard provisioning profile and manually select it solves the issue.
  • Vitalii
    Vitalii over 6 years
    The same story. Looks like mistakenly choosing Distribution profile instead of Dev one is the key here. In my case I was connected with wire when this happened.
  • David Seek
    David Seek over 6 years
    How is this a SOLUTION? Running over and over again just eats time...
  • Alex Stone
    Alex Stone over 6 years
    Running again is way quicker than doing a clean - a clean of my xcode project and rebuilding takes 4 minutes, here it's 1 minute
  • David Seek
    David Seek over 6 years
    Of course. It is a workaround. But sure as s not a SOLUTION :)
  • plivesey
    plivesey over 6 years
    It seems pretty clear to me that in many cases, this is an Xcode bug. So, short of patching Xcode yourself, there will be no solution, only work arounds.
  • Muhammad Nayab
    Muhammad Nayab about 6 years
    In most of cases you have mentioned the application would not even build. The specific issue mentioned by asker happens when it builds successfully and failed to run on device.
  • chadbag
    chadbag over 5 years
    For me it was switching between "Could not write to device" and "no code signature found". I rebooted the phone, restarted Xcode, etc. Nothing worked. The app had been working just fine and no major changes were made. The "deep clean" (holding option when choosing clean) fixed it for me.+
  • Tibin Thomas
    Tibin Thomas over 5 years
    An app signed with distribution certificate can only be distributed through test flight.It cant be installed directly.