Xcode Run Error dyld: Library not loaded: /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics - iphone

tough one this.
Recently I added another target to my iPhone project to run a command line tool to create the initial database.
Since then, I started getting this error whilst running the iPhone project:
dyld: Library not loaded: /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
Referenced from: /Users/mm/Apple Development/XCode Projects/GridTest1/build/Release-iphonesimulator/GridTest1.app/GridTest1
Reason: image not found
The Debugger has exited due to signal 5 (SIGTRAP).The Debugger has exited due to signal 5 (SIGTRAP).
The bizarre thing is that this library appears to be successfully loaded earlier.
Here's some debug output generated by dyld:
dyld: loaded: /Xcode3.2.5/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
dyld: loaded: /Xcode3.2.5/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/UIKit.framework/UIKit
Checking dyld environmental variables and of course whether the framework is actually present, everything looks good:
IPHONE_SIMULATOR_ROOT=/Xcode3.2.5/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk
DYLD_ROOT_PATH=/Xcode3.2.5/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk
Is CoreGraphics.framework here?... yes it is.
/Xcode3.2.5/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
To mystify things further:
App runs on device no problem either as release or debug.
Xcode 4 runs fine too either as release or debug.
Running in debug mode with a breakpoint set runs fine.
Fair enough you might say if it works ok in Xcode 4 why not just use that? Good point but you know how these problems can come back to haunt you. I don't want to leave this for now then it comes up again during submission.
Any advice would be greatly appreciated.
Btw I have searched countless lists and posts on this and related errors. I've also tried most of the advice there, e.g. restart Xcode, clean, etc. Unfortunately it didn't help.
Have been stuck on this for ages so some help would be awesome.
Cheers,
Max.

Did you start the project in XCode 3 (or earlier) and are now working with it in XCode 4? I cannot tell you the number of frustrations I've experienced with frameworks not referenced correctly as Apple has released new version of XCode over the past couple of years. The consensus seems to be to delete your project and create a new one in XCode 4. I have taken to manually editing the XML files before but in the end something weird just keeps happening. It may not be the "best" answer but should solve any odd framework referencing issues.
Thanks,
Rick

Related

Xcode Issue: Library not loaded: #rpath/libswiftAppKit.dylib

I've finished working on a Cocoa (not iOS) application with Swift 3. I've tested it on a desktop computer. It works fine. I've tested it on another desktop computer. It works fine. I have even managed to send it over to iTunes Connect. But I have not submitted it because the same application fails to run on a MacBook Pro (2013). Anyway, I've tested it on a MacBook Pro with a retina display. That's when the entire problem started happening. Actually, this desktop application ran on the same MacBook Pro a few days ago. I think it was not sandboxed yet. Now, every time I send a binary copy that runs on different iMac models to MacBook Pro through AirDrop and try to run the application, I get an error that says EXC_CRASH (Code Signature Invalid). So I've deleted some files inside Developer /Xcode / DerviedData. Now, I cannot even debug the application. When I debug it, it hangs up with a fatal error message, which I have never seen before.
Now, if I double-click on an application that Xcode has generated, I get a crash report that says Library not loaded: #rpath/libswiftAppKit.dylib. I thought that I might have deleted some system files by accident. But if I debug existing macOS and iOS apps, I have no problem running them. Fortunately, the entire problem occurs on this particular Xcode project.
One topic that I've found here suggest that we set the Always Embed Swift Standard Libraries option to Yes. I've done that with no vail. I have also read a suggestion that says something about setting the When using this certification option on a developer certificate to Use System Defaults, which doesn't help. Another suggestion that I've tried is clearning cache (Command + Shift + Option + K).
If you have any suggestions, please let me know. Thanks.
More information
I have also seen a bizarre alert message repeatedly on MacBook Pro that says "%#" cannot be found. This error message poped up when I double-clicked on the application icon. It may refer to
String(format: NSLocalizedString("whatever", comment: ""), variable name)
I have solved the problem! I had the same problem with you. But from the answer in https://www.reddit.com/r/swift/comments/4nac9s/using_swift_frameworks_with_command_line/, I have known that the key is the rpath.
So I try to add this path to the project in the following two settings:
${DT_TOOLCHAIN_DIR}/usr/lib/swift/macosx/
Runpath Search Paths
Library Search Paths
I don't know why need to add both the two settings, but it works!

Unable to run app in Simulator Xcode 6

Yesterday i was testing my app in the iOS simulator and everything was working fine. I then decided to run the app on my iPhone and i got the error unable to install application, Unknown error occurred this has happened before so I cleaned my build folder (as this has fixed this issue before) however, the same error occurred. I then ran the app in the iOS simulator again and now i get the error Unable to run app in Simulator, An error was encountered while running (Domain = LaunchServicesError, Code = 0). I find this very weird as i didn't change anything besides trying to run the app on my iPhone. I have tried every solution given on this post and still no luck.
I'm sorry if my question doesn't contain much detail but as I said I didn't change anything and it was building and running fine a minute before plugging in my iPhone and trying to run it on there.
Any help would be much appreciated.
edit
I tried running other projects (with and without extensions) and they are working on both simulator and iPhone, therefore the problem must be within my project. (my project does have a today extension)
In that kind of cases I usually :
Product > Clean
Close xCode
Delete the Derived Data (in ~/Library/Developer/Xcode/DerivedData subfolders)
Delete the app on the iPhone
Reboot the iPhone
Restart and rebuild
I had this problem. In my case, it was caused by the Build value being blank. After putting a value there, and resetting the simulator once more, the issue went away.
I had the same problem and checking the system log carefully helped me to identify a coliding library that was causing this error. You can also check this answer if you are using extensions.
Generally it means there is a problem with the build, it may be due to old cache (solved by a clean build) or a project definition error (missing library, bad definition in info.plist, etc).
In my case it happened only on iOS 8, turns out that my widget had the wrong bundle ID.

Guard Malloc doesn't work

I'm experimenting with different profiling options that Xcode provides, but when I enabling Guard Malloc option in Diagnostics tab and trying to run, I'm getting this error with immediate crash:
dyld: could not load inserted library: /usr/lib/libgmalloc.dylib
And it is right, /usr/lib/ doesn't contain this library. I've located it in:
Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/
So I've created link, and started Command Line Tool (just to be sure, because it apparently part of MacOS SDK), enabled Guard Malloc again but the problem remains.
I don't quite get where is a problem: does it new Xcode 4.3 inadvertence, problem with my system or planned decision by Apple to replace it with something else (maybe Instruments)?
on device or simulator?
According to http://developer.apple.com/library/ios/#DOCUMENTATION/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html
You can use this option both Mac apps and also for iPhone applications running in the simulator.
Well, I got stuck by this too. From an apple list:
http://prod.lists.apple.com/archives/xcode-users/2012/Feb/msg00197.html
That's a known issue that's being investigated. I think that you may be able to work around it by installing the 10.7.3 combo installer
Which means you need to download the combo installer from: http://support.apple.com/kb/DL1484?
I'm trying it now to make sure it works, but the person on the mailing list said it worked.
Problem came up again recently, combo update didn't helped (libgmalloc.dylib was in place).
New solution was to Repair Disk Permissions in Disk Utility:
It looks like you can't enable Guard Malloc when debugging directly on a device (at least iPad in my case), even when running the latest and greatest versions of everything. Running still works in the simulator though.

iPhone simulator crashing on startup

Okay, so my Xcode and iPhone simulator have become really screwed up lately, all i remember doing right before this started happening is i turned off my mac. So, my first problem is that every time i open up iPhone simulator, it says the simulated application can't be run and asks to switch sdk and i click 5.0 and it keeps on saying that. I have tried reinstalling Xcode 3 times now. Second, whenever i go to open up the MainStoryboard.iphone/ipad files, Xcode freezes up and gives me the option to either crash or continue in a poor state or something like that. Next, the app I'm trying to create used to work, but then all of a sudden, it would crash at startup with this error message:
dyld: Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in:/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/Sym/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-01-03 21:02:45.802 ibtoold[1399:d03] [MT] DVTAssertions: ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilderCocoaTouch/IDEInterfaceBuilderCocoaTouch-933/IBPlugin/Utilities/IBObjectMarshalling.m:179
Details: Interface Builder encountered an error communicating with the iOS Simulator. "Interface Builder Cocoa Touch Tool" (1402) failed to launch and exited with status (null), signal 5. Please check Console.app for crash reports for "Interface Builder Cocoa Touch Tool" for further information.
Function: NSDistantObject<IBCocoaTouchToolProtocol> *IBAttachToCocoaTouchTool(IBCocoaTouchTargetRuntime *)
Thread: <NSThread: 0x40010a220>{name = (null), num = 1}
That is the error that i got when beginning to run the app, now instead, it just gives me two errors while building the app and here is what those say:
Command /Developer/usr/bin/ibtool failed with exit code 255
Verify exit code of build task 'CompileStoryboard MainStoryboard_iPhone.storyboard'
Build task failed without generating error messages.
These have to be in some way related and it has either to do with the storyboard settings or the iOS simulator, this has been a huge setback for the making of my app, if anyone has had this issue, please help
EDIT: ok have been trying to see if this same thing happens on other projects and it seems to be only that app with the errors, but IOS simulator doesn't work for anything. Also, literally every other thing i try to do on Xcode now prompts a crash, even trying to open up a project and look at errors in new window.
Update to a newer version of Xcode, they run smoother and are a lot less buggy.

dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit

Please bear with me, newbie just learning the ropes.
I am getting the below message, when I try and run my app, it quiets, but then does let me re-open fine after the first quit.
I tried a few things and if I turn on if i 'activate breakpoints' it all works fine...
Tried a few suggestions, 'deleting build folder', 'restarting xCode' nothing seems to work...
dyld: Library not loaded:
/System/Library/Frameworks/UIKit.framework/UIKit
Referenced from:
/Volumes/MyBook/Apps/CToolBox/build/Debug-iphonesimulator/CToolBox.app/CToolBox Reason: image not found
The Debugger has exited due to signal
5 (SIGTRAP).The Debugger has exited
due to signal 5 (SIGTRAP).
Thanks in advance.
Try this
Just delete your personal settings files for the project.Right click on .xcodeproj file and select show package contents .They will be username.mode1v3 and username.pbxuser. I didn’t figure out which file was the cause, but deleting them sorted it out.
One other way I found today is, turning the Framework (in this case UIKit) in question as "optional". I hope you know how to do that :)
PS. I still wanna know the real reason of this abnormal linking failure? my code was working perfectly till today!
It looks like its trying to find the UIKit Framework in the wrong location. It shouldn't be looking in system frameworks but in a path like this:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/System/Library/Frameworks/UIKit.framework
Get info on the UIKit framework within Xcode and see where it thinks the path to is at. If you installed in a non-standard location that might be your problem. You could also remove and readd the framework to try and change its path.
You should also check the configuration popup to make sure you're not trying to build for Cocoa.
You can also get this sort of error message trying to write a Mac OS app if you try to use a framework that's not available on your OS version, e.g. trying to write a MacOS SpriteKit app in Mountain Lion.