Swift po causes error 'Failed to load linked library Metal' - swift

How can I print out a Swift variable's value in XCode 6 GM with LLDB? It seems to be broken since early betas. But at the same time po works perfectly fine in Objective-C code
I've previously tried all XCode 6 betas and got the same result. Even when I start a new project from scratch it's all the same. For example, I put a breakpoint in func application(application, didFinishLaunchingWithOptions)
(lldb) po application
error: Error in auto-import:
Failed to load linked library Metal of module sandbox - errors:
Looking for "#rpath/Metal.framework/Metal", error: not a string object
I've never imported or linked against Metal.framework in any of my projects. Does there exist any way to solve this?

Don't know the reason that po is broken in xCode 6, but I am able to print an object by
Right clicking an object in the Debug Area
and clicking -> Print Description of "OBJECT_NAME"
Hope this will help someone else, until the xCode bug is fixed

The bug was fixed in XCode 6.1
Resolved Issues - Debugging
Swift expressions like 'expr', 'p', and 'print' that are evaluated
from the LLDB prompt in the debugger console will now work on 32-bit
iOS devices. (18249931)
https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc6_release_notes.html

Metal.framework is a new framework provided by Apple in iOS8. Seems like AVFoundation has references to it. I think you getting this error running your app on iOS7 device or simulator. Try to check on iOS8.

Related

More unspecified crashes on Xcode 4.2

I've been using Xcode to develop iPhone Apps for a couple of years now. In the last couple of months I've updated to Xcode 4.2 for iOS 5 development.
On previous versions of Xcode I've found it very rare that I get a crash without any log of where the error happened. With Xcode 4.2 / iOS 5 I find that I regularly get crashes without any log. I just end up with the code stopped in main.m with a message like "program received signal SIGABRT" (or a couple of other messages) but no log messages at all. (I'm looking in the "All Output" window at the bottom of the Xcode gui).
For example, my last one was where I used the initWithNibName:bundle: method but typed in the incorrect nib name. The code passed this line without error, but when I got to the pushViewController:animated: method the code crashed with the SIGABRT message but no log messages. It took a while for me to find my typo...
I'm sure in previous versions of Xcode I would see a far more informative message...
Is there something I'm missing in Xcode 4.2? Should I enable some extra debugging feature? Any way to get it to give more useful crash information? Or is this a know problem with iOS 5 / Xcode 4.2?
Thanks for any pointers...
You are not alone, I have found this too. I often find there is not enough information in the log to diagnose the crash with the lastest xcode. I have two tips that might help.
Run on the actual device. I often find for some reason I get more detailed logs when it crashes on the device.
Worst case, you can go into the organiser and check the crash logs of the device, this will give you what thread crashed and what you call stacks looked like when it crashed.
Switch between the GDB and LLVM compiler and or debugger. I havent experitmented enough with this but I believe this has helped on occasion.

Can't compile code containing iOS 5 method when setting lower deployment target

Not true for all new iOS 5 methods but I've found out that calling UINavigationBar's setBackgroundImage:forBarMetrics: method will trigger an 'instance method not found' warning if the deployment target is under 5.0. This is even though I am linking with the SDK 5.0.
More importantly the enum UIBarMetrics used as a parameter there is reported as an 'undeclared identifier' and this will trigger a compiler error.
Any idea why this is so? I realized the code will not work if the deployment target is under 5.0 but I'm checking if UINavigationBar responds to that selector at run time, so everything should be ok. I don't understand the compiler error though.
EDIT:
This only happens when compiling for a device, and when a device is actually plugged in (the device I've tested with runs iOS 5.0.1).
Well, I figured out the mystery. I manage to fix the problem by deleting SDK 4.3 (I had that one copied over from Xcode 3 since it doesn't come by default with the latest Xcode+SDK package and I was using it for another legacy project).
I still can't explain why having both SDKs caused the error since I was clearly compiling with the latest SDK.

Xcode 4 Assertion Error

I am getting an assertion error when I launch Xcode 4, which I just installed. I have looked on Google and Stackoverflow, and I could not find anybody with the same problem as me. As soon as I open Xcode 4, it shows me the welcome screen. I try to open a project, and Xcode gives me a message saying I can continue using Xcode in an inconsistent state or I can crash Xcode. When I click on more details it says "ASSERTION ERROR" followed by some other debugging info. I can't copy it because when I try to highlight it Xcode freezes completely.
Any suggestions?
NOTE: This is different from other people who get this error when they build, I am getting this when it is LAUNCHED.
Could it also be because I am continuing a project from the previous version of Xcode?
[UPDATE] I have solved the problem. If you are also encountering such an error, try reinstalling Xcode 4. If you continue getting the same error, then follow the advice of #mrueg.
Xcode 4 has various bugs, and the assertion error is just a general warning that an inconsistency was detected.
The best way to get more info on the actual error that happened is to crash Xcode when you get the error and then show the details.
It probably also makes sense to send the crash report to Apple so they can fix the bug.
It is probably best to keep using Xcode 3 (which is still downloadable for the newest SDKs) and wait for the next version of Xcode 4 if your project crashes it.

XCode 4 says, "Argument Invalid" on attempt to run project

I had a project initially created in XCode 3 and used it successfully in XCode 4 Developer Preview version.
After upgrading to XCode 4 release, any time I try to run the project on the device, I get a "Argument Invalid" dialog. Except it doesn't tell me what argument.
How does one figure out what is wrong and why I can't run the app on my device any more?
Base SDK is set to 4.3
Deployment target set to: iOS 4.2
Ok, I have just managed to sort this out as I was having the same issue. This may not help you, but for me it was because I had a symlink inside a folder included in the project. I've removed this, and now it all works fine. Interestingly it works fine on the simulator in this case.
I've filed a bug with Apple on the issue (#9168893).
Just clean your producto
Menu>Product>Clean (Shift+Cmd+K)
I got the following message argument is invalid in response to some kind of USB weirdness. Sometimes it goes away if I unplug and replug the device, but what turns out to fix it more reliably is to start up iTunes. Usually, when I do this, the problematic device doesn't appear in the DEVICES list at first, but does after a few seconds, and once it does, the device and Xcode get along fine.

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

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