iOS simulator: could not hardlink copy. Wrong path in my filesystem?
Asked Answered
U

14

17

I am using Xcode Version 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.

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.

EDIT: Here is the info.plist.xml (generated by LibGDX if it matters)

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

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

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)

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}
Unbroken answered 27/11, 2014 at 9:22 Comment(9)
Please include more information. Specifically, look in ~/Library/Logs/CoreSimulator/055A18BC-73B5-4EA6-A872-488FA69F4750/system.log for additional error messages that might describe what is going wrong to trigger this. Look for messages from installd around the time of your error.Bornie
possible duplicate of An error was encountered while running (Domain = LaunchServicesError, Code = 0)Bornie
Hello @JeremyHuddlestonSequoia and thanks for your answer. I have read your answer in the other question, it is indeed close to my problem. However I couldn't give more details about my error on that question, so I have edited my question here. I may have found possible sources of errors, I hope I picked the right lines (the log is very long, even at the time of the crash)Unbroken
That looks like the problem some people have seen installing over an existing install. Try deleting the existing app or just erasing the device to a default state.Bornie
Sounds good, how can I erase the device to a default state or delete the existing app on the virtual device? I have been using the Xcode function "Reset Content and Settings" which works well, but only once, as a second launch causes the error again.Unbroken
Yes, that is how you can erase the device to the default state. You can also just delete the app like you would on a real device (long tap on home screen, then tap x) or use simctl as described in the other post.Bornie
Hey Jeremy, thank for your time helping me out. It does work when I erase the app on the virtual device or use the function "Reset content and settings", the problem is I have to do it every single run. So I guess my initial question was how to fix this problem to avoid it?Unbroken
Do you have a valid CFBundleVersion in your app's Info.plist? Can you attach the Info.plist ?Bornie
Hey @JeremyHuddlestonSequoia , I have attached the info.plistUnbroken
F
6

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. installd sometimes seems to be unable to read the CFBundleShortVersionString and CFBundleVersion values. 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. 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.

Nightly builds of RoboVM can be downloaded from http://download.robovm.org. To install a nightly build of the Eclipse plugin you should use the update site

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

Nightly SNAPSHOT builds of the RoboVM Maven and Gradle plugins are pushed to Maven Central.

Flagon answered 21/2, 2015 at 16:30 Comment(3)
Hello @ntherning, thanks for your answer. So if I understand correctly I should manually move up CFBundleShortVersionString and CFBundleVersion in the info.plist order and test ?Unbroken
Yes, try that. Move those two keys (and their values of course) to the top of the Info.plist.xml file. Starting with the next release of RoboVM you shouldn't have to do this though. Also, you should do "Reset content and settings" one last time to get rid of any bad app already installed.Flagon
It works perfectly. Thanks @ntherning. What a great pleasure to be able to simply rebuild instead of resetting simulator every single time. Productivity upgraded to lvl 3 :)Unbroken
K
53

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.

Keyser answered 30/10, 2015 at 9:32 Comment(3)
need to delete and re-runSklar
I faced this error for Xcode 9 and this answer worked for me!Achromic
I had $(CURRENT_PROJECT_VERSION) for "Bundle version".Prestige
B
11

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

This issue should be addressed in recent iOS Simulator 8.2 betas that are in Xcode 6.2 betas. I think it was addressed in either beta2 or beta3, but I can't recall for certain.

Bornie answered 26/1, 2015 at 3:25 Comment(1)
I had a script to increment build number in the plist. But I had accidentally executed the script after the compile step... thanksPhlox
F
6

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. installd sometimes seems to be unable to read the CFBundleShortVersionString and CFBundleVersion values. 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. 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.

Nightly builds of RoboVM can be downloaded from http://download.robovm.org. To install a nightly build of the Eclipse plugin you should use the update site

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

Nightly SNAPSHOT builds of the RoboVM Maven and Gradle plugins are pushed to Maven Central.

Flagon answered 21/2, 2015 at 16:30 Comment(3)
Hello @ntherning, thanks for your answer. So if I understand correctly I should manually move up CFBundleShortVersionString and CFBundleVersion in the info.plist order and test ?Unbroken
Yes, try that. Move those two keys (and their values of course) to the top of the Info.plist.xml file. Starting with the next release of RoboVM you shouldn't have to do this though. Also, you should do "Reset content and settings" one last time to get rid of any bad app already installed.Flagon
It works perfectly. Thanks @ntherning. What a great pleasure to be able to simply rebuild instead of resetting simulator every single time. Productivity upgraded to lvl 3 :)Unbroken
U
6

Find the InfoPlist.strings files. And check if the version of "CFBundleShortVersionString" = "1.1"; coincides with the version of your app in Info.plist

InfoPlist.strings

Underline answered 14/5, 2017 at 8:2 Comment(2)
You save my life!!!! This is the answer I was looking for a long long time!! Thanks!Jarvisjary
i had to unlink InfoPlist.stringsTalebearer
W
5

I encountered the same error using Xcode 8.2.1. Changing the order of items in the Info.plist did not help in my case. 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. Doing that, fixed the problem.

Winnah answered 9/1, 2017 at 17:52 Comment(0)
C
2

Option-1: 1.Goto "General Setting" by clicking on the project name on left side bar. 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.

Option-2: 1.Open Simulator. 2.Remove all apps installed by user. 3.Run your App and Enjoy. N.B: It has a demerit that every time you clean the simulator and then after, you will able to load your app.

Cabala answered 7/9, 2017 at 10:45 Comment(0)
F
1

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!

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

Fly answered 12/9, 2017 at 20:5 Comment(0)
P
1

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. This problem went away.

Phlox answered 15/2, 2019 at 5:44 Comment(0)
U
0

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

I'm using Xcode 10.1.

Urina answered 13/1, 2019 at 11:9 Comment(0)
C
0

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

Croatia answered 14/7, 2020 at 18:29 Comment(0)
U
0

This happened to me when duplicating a target, and forgot to add the new target to the pods file.

So my fix was editing the podfile to also include the new target, and running 'pod install'.

Uncanny answered 15/1, 2021 at 0:7 Comment(0)
F
0

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.

Fourthclass answered 2/3, 2021 at 16:59 Comment(0)
R
0

In my case this error is caused by unicode character in Product Name

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)

enter image description here

Rickrack answered 15/11, 2021 at 8:3 Comment(0)
A
-1
Select Project from Navigation window -> TARGET -> General -> Build or Version

Make sure both the field filled with some value.

Antiphrasis answered 10/4, 2019 at 10:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.