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

问题描述 投票:11回答:10

我使用的是Xcode Version 6.1(6A1052d)

我想在模拟器上启动一个应用程序。

它第一次总能正常工作。如果我想第二次启动,我有一个错误(见下面的日志)。然后在iOS模拟器中我“重置内容和设置”,我可以再次成功启动。

鉴于错误日志,我认为它必须与错误的路径有关。问题是我对Mac文件系统和路径链接不好,所以非常感谢你的帮助。

编辑:这是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>

还有我的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>

由于Jeremy的建议,我试图在我的虚拟设备文件夹中的system.log中更准确地识别错误。 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>

来自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}
ios xcode ios-simulator robovm
10个回答
5
投票

这确实是由应用程序的Info.plist文件中的某些键的顺序触发的,并且似乎是iOS模拟器的installd进程中的错误。 installd有时似乎无法读取CFBundleShortVersionStringCFBundleVersion值。我发现如果RoboVM确保始终在Info.plist中首先移动这些值,它会写出我们防止installd中的错误被触发。我们现在已经在RoboVM中实现了这种解决方法(请参阅问题#771),它将在下一个每晚构建(20150222版本)和下一个版本中实现。

可以从http://download.robovm.org下载每晚构建的RoboVM。要安装每日构建的Eclipse插件,您应该使用更新站点

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

每晚SNAPSHOT版本的RoboVM Maven和Gradle插件被推送到Maven Central。


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

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


49
投票

我只使用“常规”选项卡上的“版本”将“构建”字段留空时遇到此错设置构建值并重新安装应用程序后,错误消失了。


8
投票

如果您将应用程序的Info.plist从一个版本更改为下一个版本(例如加速CFBundleVersion或类似版本),我认为问题会更加严重。如果你这样做,你应该在每次启动之间(通过SpringBoard或使用simctl)从模拟器中删除应用程序,或者只是擦除sim设备。

这个问题应该在Xcode 6.2测试版中最近的iOS模拟器8.2测试版中解决。我认为它已在beta2或beta3中得到解决,但我无法回想起来。


5
投票

我使用Xcode 8.2.1遇到了同样的错误。更改Info.plist中项目的顺序对我的情况没有帮助。但它确实引导我走向解决方案。我已经将CFBundleShortVersionString和CFBundleVersion从3.0.0更改为3.0.1,但我已将FORGOTTEN更改为本地化和基本InfoPlist.strings文件中的3.0.1。这样做,解决了问题。


4
投票

找到InfoPlist.strings文件。并检查“CFBundleShortVersionString”的版本是否为“1.1”;与Info.plist中的应用程序版本一致

InfoPlist.strings


1
投票

选项-1:1。单击左侧栏上的项目名称,转到“常规设置”。 2.将Bundle Identifier名称更改为“com.release.ABC”(ABC可能是任何其他名称。最好用您的APP名称替换ABC)3。现在运行它并享受。

选项-2:1。打开模拟器。 2.删除用户安装的所有应用程序。 3.运行您的应用程序并享受。 N.B:它有一个缺点,每次你清理模拟器,之后,你将能够加载你的应用程序。


1
投票

我也有这个问题很长一段时间。我尝试了大部分这些解决方案。我相信他们为某些人工作,但不适合我......

然后我注意到,如果你去Project Settings -> Build Phases -> Embed Frameworks,只有在安装时才有复制标志......我勾选了它。这个问题消失了。


0
投票

这为我修好了:

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

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

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


0
投票

我在一个多目标项目中遇到过这个问题。复制目标后,我忘了更改“产品包标识符”。将此参数更改为唯一值后(请参阅“构建设置”选项卡),错误消失。

编辑

更改“产品包标识符”后,必须清除模拟器中的所有内容和设置,并在Xcode中清除构建文件夹(Cmd + Shift + K)。

我正在使用Xcode 10.1。

© www.soinside.com 2019 - 2024. All rights reserved.