Xcode 9 App 安装失败,无法写入设备

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46319561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:15:51  来源:igfitidea点击:

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

iosxcodeios11xcode9

提问by Alex Stone

I've just updated to Xcode 9 and am getting App installation failed Could not write to the deviceerror 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.

我刚刚更新到 Xcode 9,App installation failed Could not write to the device每隔一段时间都会弹出错误消息。我看到关于这个主题有一些较旧的问题,但这个问题是针对 iOS 11 和 Xcode 9 的。我以前从未遇到过这个问题。

Screenshot

截屏

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

如何确保 Xcode 9 每次都可以将应用程序安装到设备?

回答by Vlad Papko

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.

在我的情况下,这个问题是由在 iPad 无线连接时使用 App Store 分发证书引起的。切换到开发证书解决了这个问题。

回答by plivesey

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):

Xcode 9 似乎对这个问题有很多不同的表现。其他一些答案解决了特定问题,但是当您的项目没有任何问题时,肯定会发生这种情况。这些步骤总是为我解决(从最不痛苦到最痛苦的顺序):

  • 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+Kor hold option in the product menu) and then rebuild.
  • 尝试再次运行它。有时它在第 3 次或第 4 次起作用。
  • 拔下设备并重新插入。
  • 重新启动Xcode。
  • 干净生成文件夹(不是一般的干净-这是cmd+ option+ shift+K或保持在产品菜单选项),然后重建。

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.

希望 Xcode 能尽快解决这些问题……但我不抱希望。

回答by Bill Chan

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.

就我而言,我想测试 watchOS 应用程序,并将调试配置文件设置为发布一个。我设置为自动,问题消失了。

回答by Alex Stone

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.

从设备中删除应用程序也有帮助。

回答by Jayprakash Dubey

I had similar issue and got is solved using below steps :

我遇到了类似的问题,并使用以下步骤解决了:

  1. Delete appfrom device
  2. Disconnect devicefrom system
  3. Restart iPhone deviceand Xcode
  4. Delete derived data content
  5. Clean your project(Shortcut key : cmd + shift + k)
  6. Rebuildyour project
  1. Delete app从设备
  2. Disconnect device从系统
  3. Restart iPhone deviceXcode
  4. 删除派生数据内容
  5. Clean your project(快捷键:cmd + shift + k
  6. Rebuild你的项目

回答by VDPATEL

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.

我在 iPad 上遇到了同样的问题。它之前工作正常。但一段时间后,我的开发版本停止在 iPad 上运行。我已经尝试并在互联网上搜索,但无法找到解决方案。我已经尝试了上述所有情况,但没有运气。

At last, I have found solutions. Some developer has changed DATE/TIME settingsfor my Ipad. Please check date/time because my Provisional profile for apps has expired for the manual date set on iPad.

最后,我找到了解决方案。一些开发人员更改了我的 Ipad 的日期/时间设置。请检查日期/时间,因为我的应用程序临时配置文件已在 iPad 上设置的手动日期过期。

回答by Maddy

Hope the following steps will be useful for others,

希望以下步骤对其他人有用,

  1. Check your provisioning profile is valid.
  2. choose the debug profile for signing in target.
  3. Open you scheme under product in menu toolbar or using Cmd + <shortcut.
  4. Choose debugmode for Run in your product scheme.
  1. 检查您的配置文件是否有效。
  2. 选择用于登录目标的调试配置文件。
  3. 在菜单工具栏中的产品下或使用Cmd + <快捷方式打开您的方案。
  4. 在您的产品方案中为 Run选择调试模式。

Tadaa! now you can run the app in your device flawlessly.

多啊!现在您可以在您的设备上完美运行该应用程序。

Happy coding! :)

快乐编码!:)

回答by hook zou

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

我通过删除由 ln -s

回答by superm0

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.

就我而言,当我在包含符号链接的项目中添加文件夹作为参考时,会出现此问题。删除符号链接解决了这个问题。

回答by Igor Leonovich

In my case the problem appears while I use manual signingand 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 signingmode fixed this issue.

在我的情况下,当我使用手动签名并尝试在发布模式下调试应用程序时出现问题。尽管在此模式下 fastlane 构建和上传正常,但直接 XCode 调试失败并显示错误"Could not write to the device"。临时切换到自动签名模式解决了这个问题。