简体   繁体   English

iOS 模拟器:无法硬链接复制。 我的文件系统中的路径错误?

[英]iOS simulator: could not hardlink copy. Wrong path in my filesystem?

I am using Xcode Version 6.1 (6A1052d)我正在使用 Xcode 版本 6.1 (6A1052d)

I am trying to launch an app on the simulator.我正在尝试在模拟器上启动一个应用程序。

The first time it always works fine.第一次它总是工作正常。 If I want to launch a second time, I have an error (see log below).如果我想第二次启动,我有一个错误(见下面的日志)。 Then in iOS simulator I "Reset Content and Settings" and I can launch again successfully.然后在 iOS 模拟器中我“重置内容和设置”,我可以再次成功启动。

Given the error log, I think it must have something to do with a wrong path.鉴于错误日志,我认为它一定与错误的路径有关。 The problem is I am bad with Mac filesystem and path linking, so your help would be much appreciated.问题是我对 Mac 文件系统和路径链接很不满意,因此非常感谢您的帮助。

EDIT : Here is the info.plist.xml (generated by LibGDX if it matters)编辑:这是 info.plist.xml (如果重要的话,由 LibGDX 生成)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>${app.name}</string>
    <key>CFBundleExecutable</key>
    <string>${app.executable}</string>
    <key>CFBundleIdentifier</key>
    <string>${app.id}</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${app.name}</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>${app.version}</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>${app.build}</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>UIStatusBarHidden</key>
    <true/>
    <key>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
        <integer>2</integer>
    </array>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
        <string>opengles-2</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <!-- <string>UIInterfaceOrientationPortrait</string> -->
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>CFBundleIcons</key>
    <dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>Icon</string>
                <string>Icon-72</string>
            </array>
        </dict>
    </dict>
</dict>
</plist>

And my robovm.xml:还有我的 robovm.xml:

app.version=1.0
app.id=<my package name>.IOSLauncher
app.mainclass=<my package name>.IOSLauncher
app.executable=IOSLauncher
app.build=1
app.name=<my app name>

I have tried to identify more precisely the error thanks to the advice of Jeremy, in the system.log inside the folder of my virtual device.由于 Jeremy 的建议,我试图更准确地识别错误,在我的虚拟设备文件夹内的 system.log 中。 The system.log has a lot of entries around the time of the crash, so I might have missed something... Anyway I have found these potentials errors: system.log 在崩溃时有很多条目,所以我可能错过了一些东西......无论如何我发现了这些潜在的错误:

Nov 28 09:03:44 As-MacBook-Pro installd[668]: 0x10e3d0000 createDictFromFile: open failed for /Users/<myname>/Library/Developer/CoreSimulator/Devices/D1C6E4CE-ABF3-4621-B811-913F1705CBE0/data/Containers/Bundle/Application/CA2B6D8C-1A62-4DA6-8433-AA4678D009E1/ManifestCache.plist : No such file or directory

Nov 28 09:03:44 As-MacBook-Pro installd[668]: 0x10e4d6000 writeDictToFile: ==== Successfully wrote Manifest cache to /Users/<myname>/Library/Developer/CoreSimulator/Devices/D1C6E4CE-ABF3-4621-B811-913F1705CBE0/data/Library/Caches/com.apple.mobile.installd.staging/temp.gCGKCY/extracted/ManifestCache.plist

Nov 28 09:03:44 As-MacBook-Pro installd[668]: 0x10e3d0000 validate_stream: Got manifest for version "1 1.0", but expected version "1 "

Nov 28 09:03:44 As-MacBook-Pro installd[668]: 0x10e3d0000 hardlink_copy_hierarchy: Failed to open manifest /Users/<myname>/Library/Developer/CoreSimulator/Devices/D1C6E4CE-ABF3-4621-B811-913F1705CBE0/data/Library/Caches/com.apple.mobile.installd.staging/temp.gCGKCY/extracted/com.apple.deltainstallcommands.<my app.id>

The original crash log from Eclipse console (device name folders are different as I have tested on multiple virtual devices, but the error is always the same)来自 Eclipse 控制台的原始崩溃日志(设备名称文件夹不同,因为我在多个虚拟设备上测试过,但错误始终相同)

11/27/14 9:58:17 AM: [ERROR] Session could not be started: 
Error Domain=LaunchServicesError 
Code=0 "Unable to run app in Simulator" UserInfo=0x7fc8eb900d70 
{Error=PackagePatchFailed, ErrorDescription=Could not hardlink copy 
/Users/<myname>/Library/Developer/CoreSimulator/Devices/055A18BC-73B5-4EA6-A872-488FA69F4750/data/Containers/Bundle/Application/CCF8C472-C48F-41D7-8885-E83830256EE3/IOSLauncher.app 
to 
/Users/<myname>/Library/Developer/CoreSimulator/Devices/055A18BC-73B5-4EA6-A872-488FA69F4750/data/Library/Caches/com.apple.mobile.installd.staging/temp.TsGEn1/extracted/Payload/IOSLauncher.app 
with manifest 
/Users/<myname>/Library/Developer/CoreSimulator/Devices/055A18BC-73B5-4EA6-A872-488FA69F4750/data/Library/Caches/com.apple.mobile.installd.staging/temp.TsGEn1/extracted/com.apple.deltainstallcommands.<pathtomyappexec>, 
NSLocalizedFailureReason=An error was encountered while running 
(Domain = LaunchServicesError, Code = 0), 
NSUnderlyingError=0x7fc8ebb1a500 "The operation couldn’t be completed. 
(LaunchServicesError error 0.)", 
NSLocalizedDescription=Unable to run app in Simulator}

I faced this error while leaving Build field blank using only Version on General tab.我在“常规”选项卡上仅使用“版本”将“构建”字段留空时遇到了此错误。 The error has gone after setting a build value and reinstalling the app.设置构建值并重新安装应用程序后,错误消失了。

I believe the issue is exacerbated if you change your app's Info.plist from one build to the next (such as revving CFBundleVersion or similar).我相信如果您将应用程序的 Info.plist 从一个版本更改为下一个版本(例如 revving CFBundleVersion 或类似版本),问题会加剧。 If you do that, you should delete the app from the simulator between each launch (either via SpringBoard or using simctl) or just erase the sim device.如果你这样做,你应该在每次启动之间从模拟器中删除应用程序(通过 SpringBoard 或使用 simctl)或只是擦除 sim 设备。

This issue should be addressed in recent iOS Simulator 8.2 betas that are in Xcode 6.2 betas.这个问题应该在最近的 iOS 模拟器 8.2 测试版中解决,这些测试版在 Xcode 6.2 测试版中。 I think it was addressed in either beta2 or beta3, but I can't recall for certain.我认为它是在 beta2 或 beta3 中解决的,但我不记得了。

This is indeed triggered by the order of certain keys in your app's Info.plist file and what seems to be a bug in the iOS simulator's installd process.这确实是某些键的顺序在应用程序的Info.plist文件触发,似乎是在iPhone模拟器的一个bug installd过程。 installd sometimes seems to be unable to read the CFBundleShortVersionString and CFBundleVersion values. installd有时似乎无法读取CFBundleShortVersionStringCFBundleVersion值。 I've found that if RoboVM makes sure to always move those values first in the Info.plist it writes out we prevent the bug in installd from being triggered.我发现如果 RoboVM 确保始终首先在Info.plist移动这些值,它会写出我们防止触发installd的错误。 We have now implemented this workaround in RoboVM (see issue #771 ) and it will be in the next nightly build (the 20150222 build) and in the next release.我们现在已经在 RoboVM 中实现了这个解决方法(参见问题#771 ),它将在下一个夜间构建(20150222 构建)和下一个版本中。

Nightly builds of RoboVM can be downloaded from http://download.robovm.org .可以从http://download.robovm.org下载每晚构建的 RoboVM。 To install a nightly build of the Eclipse plugin you should use the update site要安装 Eclipse 插件的夜间构建,您应该使用更新站点

http://download.robovm.org/nightlies/eclipse/site.xml

Nightly SNAPSHOT builds of the RoboVM Maven and Gradle plugins are pushed to Maven Central. RoboVM Maven 和 Gradle 插件的 Nightly SNAPSHOT 构建被推送到 Maven Central。

Find the InfoPlist.strings files.找到 InfoPlist.strings 文件。 And check if the version of "CFBundleShortVersionString" = "1.1";并检查“CFBundleShortVersionString”=“1.1”的版本; coincides with the version of your app in Info.plist与您在 Info.plist 中的应用程序版本一致

InfoPlist.strings

I encountered the same error using Xcode 8.2.1.我在使用 Xcode 8.2.1 时遇到了同样的错误。 Changing the order of items in the Info.plist did not help in my case.更改 Info.plist 中项目的顺序对我来说没有帮助。 But it did lead me towards the solution.但它确实引导我走向解决方案。 I had changed both CFBundleShortVersionString and CFBundleVersion from 3.0.0 to 3.0.1, BUT I HAD FORGOTTEN to also change to 3.0.1 in the localized and base InfoPlist.strings files.我已将 CFBundleShortVersionString 和 CFBundleVersion 从 3.0.0 更改为 3.0.1,但我忘记在本地化和基本 InfoPlist.strings 文件中也更改为 3.0.1。 Doing that, fixed the problem.这样做,解决了问题。

Option-1: 1.Goto "General Setting" by clicking on the project name on left side bar.选项1: 1.点击左侧栏的项目名称,进入“常规设置”。 2.Change the Bundle Identifier name to "com.release.ABC" (ABC may be any other name. It's better to replace ABC with your APP Name) 3. Now run it and Enjoy. 2.将 Bundle Identifier 名称更改为“com.release.ABC”(ABC 可以是任何其他名称。最好将 ABC 替换为您的 APP 名称) 3. 现在运行它并享受。

Option-2: 1.Open Simulator.选项 2: 1. 打开模拟器。 2.Remove all apps installed by user. 2.删除用户安装的所有应用程序。 3.Run your App and Enjoy. 3.运行您的应用程序并享受。 NB: It has a demerit that every time you clean the simulator and then after, you will able to load your app.注意:它有一个缺点,即每次清洁模拟器后,您都可以加载您的应用程序。

This fixed it for me:这为我修复了它:

SIMULATOR_NAME="iPad Air 2"
# Erase a device's contents and settings
xcrun simctl erase "${SIMULATOR_NAME}"

Thanks to https://encyclopediaofdaniel.com/blog/xcode-6-reset-simulators-from-the-command-line/ for the explanation!感谢https://encyclopediaofdaniel.com/blog/xcode-6-reset-simulators-from-the-command-line/的解释!

My env: xcode 8.3.1 iOS 10.3 (14E269) SIMULATOR_NAME="iPad Air 2"我的环境: xcode 8.3.1 iOS 10.3 (14E269) SIMULATOR_NAME="iPad Air 2"

I had this issue too for a long time.我也有这个问题很长时间了。 I tried most of these solutions.我尝试了大多数这些解决方案。 I'm sure they worked for some people, but not for me...我敢肯定它们对某些人有效,但对我无效...

Then I noticed if you go to Project Settings -> Build Phases -> Embed Frameworks there is a flag for Copy only when installing ... I ticked it.然后我注意到,如果您转到“ Project Settings -> Build Phases -> Embed Frameworks ,则只有在安装时才会有一个复制标志......我勾选了它。 This problem went away.这个问题就迎刃而解了。

I experienced this issue in a multi-target project.我在多目标项目中遇到过这个问题。 After duplicating a target I forgot to change the "Product Bundle Identifier".复制目标后,我忘记更改“产品包标识符”。 Once I changed this parameter into a unique value (see tab "Build Settings"), the error disappeared.一旦我将此参数更改为唯一值(请参阅选项卡“构建设置”),错误就消失了。

EDIT编辑

After changing the "Product Bundle Identifier" you must erase all content and settings from the simulator and clean your build folder in Xcode (Cmd+Shift+K).更改“产品包标识符”后,您必须清除模拟器中的所有内容和设置,并清理 Xcode 中的构建文件夹(Cmd+Shift+K)。

I'm using Xcode 10.1.我正在使用 Xcode 10.1。

In my case, it was a file that was not included in the application that had the emulator.就我而言,它是一个未包含在具有模拟器的应用程序中的文件。 Just remove the emulator app, clean, recompile and start it.只需删除模拟器应用程序,清理,重新编译并启动它。 When adding the file, and make sure the "Copy items if necessary" check box is enabled添加文件时,请确保已启用“如有必要,请复制项目”复选框

This happened to me when duplicating a target, and forgot to add the new target to the pods file.我在复制目标时发生了这种情况,但忘记将新目标添加到 pods 文件中。

So my fix was editing the podfile to also include the new target, and running 'pod install'.所以我的修复是编辑 podfile 以包含新目标,并运行“pod install”。

The issue in our case was using a Swedish "Å" character in the Product Name.我们案例中的问题是在产品名称中使用了瑞典语“Å”字符。 Had to use a user defined setting for the display name instead, then uninstall the app from the simulator and probably also a Clean Build Folder.必须使用用户定义的显示名称设置,然后从模拟器卸载应用程序,可能还有一个 Clean Build 文件夹。

In my case this error is caused by unicode character in Product Name在我的情况下,此错误是由Product Name unicode 字符引起的

Use Ascii for Product Name and error gone (Note that Display Name is app name displayed below app icon so don't worry to change Product Name )使用Ascii作为Product Name和错误消失(请注意, Display Name是应用程序图标下方显示的应用程序名称,所以不要担心更改Product Name

在此处输入图片说明

Select Project from Navigation window -> TARGET -> General -> Build or Version

确保两个字段都填充了一些值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM