Xcode is crashing when launching app with CoreSpotlight (9.0+) on iOS 8.3 - ios

I'm working on integrating CoreSpotlight framework functionality with the app and try to run it on iOS 8.3 device. Every time I've got:
dyld: Library not loaded: /System/Library/Frameworks/CoreSpotlight.framework/CoreSpotlight
Referenced from: /private/var/mobile/Containers/Bundle/Application/F9714BAD-1386-42A7-9B5F-5C06607AF6CE/Quotes.app/Quotes
Reason: image not found
I have marked CoreSpotlight as Optional.
Every target (App + Tests) has set Link Frameworks Automatically to NO and also main project has this flag set the same.
I don't see where is the problem and why this is still not working.
Thank you in advance!

I ran into the same problem, but resolved it this way:
under "Linked Frameworks and Library", added CoreSpotlight, and
marked it as Optional
Clean build folder (Alt+Shift+Command+K)
Build and run on iOS8 device
Works for me (Xcode7 Beta4)

Related

Error while compiling the project with an Xcode 9.3

I have a problem when I try to compile my project on real device. It says build succeeded and then I get the error below.
dyld: Library not loaded: #rpath/Agrume.framework/Agrume Referenced
from:
/var/containers/Bundle/Application/E3ABC8B5-A3C0-4FE3-B395-6A171C9E0EF6/myapp.app/myapp
Reason: image not found (lldb)
I tried to add the framework in the settings Build Phases/Build settings but it doesn't work.
You are probably not embedding the framework in your application.
Look at the General settings for your application target. There should be a section called "embedded binaries". Add your linked framework to that, and it should be OK. Here's an example:
I had the same issue and it was only fixed by rebuilding the used framework with newer swift version (4.0.3 -> 4.1). I had to download the library source and make a build myself.

WatchOS 2 App fails to launch on device with dyld_fatal_error for my Framework Library not loaded: Image not found

I've just followed the apple transition guide to upgrade my ObjectiveC app to WatchOS 2
https://developer.apple.com/library/watchos/documentation/General/Conceptual/AppleWatch2TransitionGuide/ConfiguretheXcodeProject.html
With the section "Sharing Code Between an iOS App and a watchOS App" describing how to duplicate an existing iOS framework into a WatchOS framework target for use by WatchOS as follows.
"If you already have a watchOS 1 app that shares a framework with your iOS app, duplicate your iOS framework target and modify it to support watchOS 2.
To duplicate and configure your framework target for watchOS 2
Open the project editor pane of Xcode. (The pane is normally closed.)
Control-click the target to display a context menu with a Duplicate command.
Change the name of the target so that you can identify it easily later.
In Build settings, change the following values:
Change the Supported Platforms setting to watchOS.
Change the Base SDK setting to the latest watchOS.
Change the Product Name setting so that it matches the name of your iOS framework. You want both frameworks to be built with the same name.
Add the framework to your WatchKit extension’s list of linked frameworks."
I've followed these steps to clone my framework which with the iOS framework was called MyFramework, and now the new WatchOS framework is called MyFrameworkWatch. But as described above the Product Name is set to MyFramework instead of MyFrameworkWatch. I presume this naming shift is so that I can include from my framework using
#import <MyFramework/SharedUtils.h>
instead of presumably having to change it to
#import <MyFrameworkWatch/SharedUtils.h>
I wouldn't mind the latter but I'll admit its nicer keeping the framework name the same.
After a bit more work beyond the initial automatic transition I managed to get my app working perfectly well on the simulator, but now switching to device i just can't get it to launch.
Launching my app on the device causes it to spin for a few seconds and then just crash. Launching the glance just causes it to spin indefinitely. Trying to run it from Xcode and running the app causes the app to eventually launch and spin, the spinning can last indefinitely sometimes, but eventually it gets through and i get the actual error reported as follows
dyld_fatal_error - dyld: Library not loaded: #rpath/MyFramework.framework/MyFramework referenced from WatchKit Extension Reason: image not found
So this is my Watch App Extension trying to link to the Watch framework, and doing so looking for the MyFramework name, not the MyFrameworkWatch name. I wonder if this name clashing has caused it to get confused?
When I try to find the frameworks referenced under the Products folder in Xcode I can see two frameworks
MyFramework
MyFramework
they're both reference the same path
/Users/jim/Library/Developer/Xcode/DerivedData/MyApp-byegspjumgwlfpahhwjgzpmfkcdx/Build/Products/Debug-iphoneos/MyFramework.framework
though you can see the target membership is separating the two frameworks, the top MyFramework is associated with the main app, today widget and framework tests project. The lower MyFramework is just associated with my Watch extension. It doesn't feel right that these are referencing the exact same path surely?
Finally when googling for this issue I've found reference of CocoaPods having similar problems though according to their site here
https://github.com/CocoaPods/CocoaPods/issues/4180
It's been fixed since September in version 0.39.0, which is the version that pod --version reports. So I presume I have their fix. I'm tempted to remove the cocoa pods from my framework to see if it helps.
Has anyone else followed the transition guide suggestions for creating a duplicate framework and then managed to get the app and framework actually installing on their watch ok?
Is there any way to analyse the build that is done to try and see if i can see problems with the built files so i don't have to wait for the watch to fail to launch the app to debug it.
Any help is really appreciated as always! Cheers!
Edit: I think I've managed to remove cocoa pods from the offending MyFrameworkWatch target by commenting out the target section in my pod file and running pod update/pod install... it didn't seem to clean up the target very well so i had to manually remove the cocoa pod steps in the post build step. Maybe i've not removed it properly, i find it a little confusing to know what is going on under the hood with cocoa pods. Regardless the same error occurred, so either i didn't remove it properly or it has no effect on this particular problem
Ok, this was caused by the apple documentation for transitioning being wrong, or me interpreting it wrong. It says
Add the framework to your WatchKit extension’s list of linked frameworks.
Where as actually the correct fix was to add the framework to the embedded binaries section (which automatically adds an entry to the linked frameworks anyways) and correctly places the framework within the watch extension under a Frameworks directory. Which the app then loads fine! So much frustration, I lost hours to this across a few days!!

AppCode run iOS simulator "Library not loaded"

I was trying AppCode 3.1. I had a iOS 8.1 project with XCode 6.1.1 with one one linked framework. The framework is SwifteriOS.framework build with Carthage (https://github.com/Carthage/Carthage) like this:
github "mattdonnelly/Swifter" == 1.4.1
Everything in XCode works fine, but when I tried to start the project in simulator with AppCode, the console gives me:
/Users/daiwei/Library/Caches/appCode31/DerivedData/Avetuc-36d98cf8/Build/Products/Debug-iphonesimulator/Avetuc.app
Simulator session started with process 17951
Debugger attached to process 17951
dyld: Library not loaded: #rpath/SwifteriOS.framework/SwifteriOS
Referenced from: /Users/daiwei/Library/Developer/CoreSimulator/Devices/C325D5F4-DDCF-41C5-9F7D-6CC17F175DA4/data/Containers/Bundle/Application/AB30E0FB-7A0F-4914-B6EB-B02B26CB5741/Avetuc.app/Avetuc
Reason: image not found
Exception: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0))
I can see the simulator launching and showing the launch screen of the app. But app just crash with above message.
image not found usually refers to the framework's binary not being loaded, usually because it's not actually ever copied over to the app's binary.
It could be that Xcode is properly copying over the framework for you, while AppCode doesn't have the instructions to do so. Make sure to follow the Run Script phase instructions (https://github.com/Carthage/Carthage#if-youre-building-for-ios) so that you know for sure that the frameworks will make it over. Also, ensure that the library shows up in "Linked Frameworks and Libraries" as well.

xcode gm ios 8 gm swift today extension crash in simulator and device: Library not loaded: #rpath/libswiftCore.dylib

I get this error when I run my Today extension for iOS:
dyld: Library not loaded: #rpath/libswiftCore.dylib
Referenced from: /Users/andy/Library/Developer/CoreSimulator/Devices/724FF0C3-6622-4D12-865A-90244C8C63C1/data/Containers/Bundle/Application/30D8974B-ED1A-4F3A-8958-E9B7AA8901A9/App.app/PlugIns/Today.appex/Today
Reason: image not found
I've restarted, uninstalled, installed xcode, rebooted my machine, created a fresh Today extension and I still got this error :-/
Same problem on simulator and on device..
Do you have any idea?
Build settings -> "Embeded content contains Swift Code" -> YES seems to do the trick.
Thanks #dlinsin on twitter
If still not working check this too:
https://stackoverflow.com/a/25247890/2184338
mine is:
edit:
if still still not:
Check "runpath search paths"
Check Linked Frameworks (I only have NotificationCenter.framework in
my case)
Product->clean
Restart xcode
Restart machine
Check provisioning and signature
I also met this problem, but Build settings -> "Embeded content contains Swift Code" -> YES invalid

dyld isuess (Library not loaded)

I have this message when I build my project:
dyld: Library not loaded:
#rpath/iPhoneSimulatorRemoteClient.framework/Versions/A/iPhoneSimulatorRemoteClient
Referenced from: /Users/dev01/mobile/ios/Test/test/testTests/FoneMonkey/bin/iphonesim
Reason: image not found
This is dynamic link error and as I understand correct this error came because image not found. is this correct?
What steps should be taken to resolve errors?
I have found this link and as I understad this error came because I use xcode 4.3. Now I have try this on 4.2 and everething work good.
But I not have any idea how to run it on XCode 4.3
Maybe you have this problem after adding new library and you linked it in actual framework path, if you drag this library in embeded framework path then problem will solve. Another variant is that in build scheme you have enabled memory managment malloc, if you turn it off problem will be solved.
Check your SDK project settings (i.e. when passing from SDK 6.x to 7.x) maybe one of library was not compiled for architecture and project target. And the paths. Clean DerivedData and delete app from simulator (if it is there).
If you still need the Sdk just copy it from Xcode 4.6.(3) both for device and simulator and see if this solve your problem.

Resources