ios - moving frameworks broke the project - ios

I recently added the Social.framework and Accounts.framework to my ios project. It was placed on top of the navigator area and I dragged those two into the frameworks folder. Then it showed in red color in the Build Phases "Link Binary with Libraries" ....and now the project crashes on startup.
What did I do so wrong? And what is the correct way to fix this?
I get this error:
dyld: Library not loaded: /System/Library/Frameworks/Social.framework/Social
Referenced from: /Users/owner12/Library/Application Support/iPhone Simulator/5.1/Applications/823A0485-7443-4206-B9F5-A84C03DBFB89/BusinessPlan.app/BusinessPlan
Reason: image not found

You didn't do anything wrong. Sometimes Xcode gets confused. I would suggest that you edit the project, scroll down to where it lists the frameworks, and select the Social and Accounts frameworks and click the Minus button.
After that, you might want to quit Xcode and clean out the build folder as described here:
How to Empty Caches and Clean All Targets Xcode 4
If that doesn't solve it, you might have to revert to an earlier commit.

Related

dyld: Library not loaded: #rpath .. reason: image not found

I am running into the above mentioned error on Xcode 10.2.1 and iOS 11 when adding my custom framework to an existing project.
I tried all the options mentioned in the previous questions asked related to this same error.
Always Embed Swift Binaries is set to yes, cleaned, removed derive data, reinstalled the certs.
Would anyone be able to help with this?
You need to also add your framework as Embedded Binary. Go to your target, select "General" tab and "Embedded Binaries" there.
Most of the times, you are using Apple (iOS) provided frameworks, that come as part of iOS and there is no need to do anything else, but define you're using them. That's the "Linked Framework and Libraries" part. When you use your own framework however, you need to embed it as part of your application and also add it to "Embed Binaries".

Error manually adding framework required by another framework

I'm trying to implement this wonderful framework: https://github.com/Yalantis/Koloda
The framework requires Facebook Pop, I don't like using cocoa pod so I added Pop manually, like this:
And I linked Pop to Koloda, Koloda to main project.
I succeeded running on simulator, but When I ran on iPhone, after the app launches, the compiler says:
dyld: Library not loaded: #rpath/pop.framework/pop
Referenced from:
/private/var/containers/Bundle/Application/9FC4B4D6-35AE-4233-9873-13905A64F725/Memory
Alarm.app/Frameworks/Koloda.framework/Koloda
Reason: image not found
Xcode 7.3.1. Base SDK 9.3 . I was able to compile and run project by manually adding Kolada and Facebook pop. I am not sure if you tried adding Kolada as Embedded project. (Available since ios8). Here are steps I followed:
Right click on my project to add "Kolada".
Right click on Kolada to add Facebook Pop.
2.1. Make sure Facebook Pop is added in General -->Linked Framework and Libraries.
2.2 And in Build Phases --> Add Copy Files Phase. Make destination as Framework and Add pop.framework here.
Add Kolada as Embedded project . Select your project Target . General --> Embedded Binaries.
Following questions might be helpful to you:
Reason: no suitable image found.
dyld: Library not loaded. Reason : no suitable image found
I am attaching screenshots.
Adding Kolada to Project
Once you've added pop to Koloda, you then can add the iOS framework for pop to Koloda, it should appear at the top of the list. Does the Koloda project compile?
Big thanks to #kamal and #JingJingTao for trying so hard to help me with this problem, I solved eventually with Cocoa Pods.
There seems to be some code signing issue with Xcode 7, which is marked out in Xcode 8, unfortunately I wasn't able to use Xcode 8 to build due to the other libraries need upgrade, this problem seem to be very common:
dyld: Library not loaded: #rpath/libswift_stdlib_core.dylib
Eventually, as #JingJingTao suggested, I had to try Cocoa Pods, and it worked, guess for now, it's the only solution.
Last thoughts, Cocoa Pods has an open community, people discuss and fix almost every issue you can encounter, while with Xcode, when you are freaking out with a problem, no one will tap on your shoulder and say: "Hey this is a bug and we will fix it later. " because, they are not open source.

Swift project with cocoapods new errors when watchkit added

I have a working Swift IOS project that uses an Objective C SDK. The SDK code is installed and updated with cocoapods. There is a bridging header file in the Swift project. This project has been compiled and run many times, and is fully operational. And of course, since it has been built and run, the workspace file is how it is opened...
I added a watchkit extension to it. I ran pod update to make a new lock file. I confirmed the search path in the watchkit includes the pods/recursive. I added the header file to Watchkit Extension.
Those three steps are the only suggestions I've been able to find regarding making cocoapods managed code work with Watchkit.
I get three errors. they are:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_SparkCloud", referenced from:
__TMaCSo10SparkCloud in InterfaceController.o
"_OBJC_CLASS_$_SparkDevice", referenced from:
__TMaCSo11SparkDevice in InterfaceController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anyone have a suggestion for further steps that may allow the project to compile?
As mentioned in the question, this Swift IOS project uses cocoapods to manage an objective C SDK that provides access to a Cloud API.
Take these steps after adding the WatchKit Extension to the Xcode project.
In the project main folder (blue, top) Info tab, note that in the section Debug,there is an entry of None beside the WatchKit Extension. Change this to Pods.debug. Click on it and choose Pods.debug.
Under the Release section, change the WatchKit Extension from None to Pods.release
Now click on the WatchKit Extension Target and choose the General tab. Here the Linked Frameworks and Libraries will be empty. Click the plus sign and choose from the list libPods.a and add it, make sure the Required option (to the right) is selected.
That should finish the job of getting your cocoapods library accessible to the InterfaceController.swift file under WatchKit Extension, which is where you write the code that "runs" the watch.
It looks like you are missing the SparkCloud.framework in your project. You can add it by:
Clicking on your project in the upper left of the left pane (the blue icon).
Navigate to "Build phases."
Under "Link Binary With Libraries", click on the plus button.
Find the SparkCloud.framework from the list and hit Add. You may also want to add any other frameworks that are required for the Spark SDK.
This will ensure that the Spark frameworks are found by the linker.
Click build, and the error should go away.

dyld: Library not loaded: #rpath/MyDSK.framework/MyDSK -> SWIFT iOS 8.0

I'm currently develop an swift SDK.
When compile the sample with the swift SDK, I got an error
dyld: Library not loaded: #rpath/MyDSK.framework/ODBlockChainWallet
Referenced from: /Users/{}/Sample.app/Sample
Reason: image not found
And if I go on the referenced folder, I can see the swift SDK T_T
Any idea?
I was having this problem and was able to fix it by adding the Swift framework (MySDK.framework) to the "Embedded Binaries" section of the "General" tab of the Xcode project settings. Then deleting the derived data and rebuilding.
Maybe you forgot to add the Copy Files Build Phase in your projects targets with "Framework" as destination
LOP_Luke's solution only half did it for me. After I added my embedded frameworks to the "Embedded Binaries" in the General tab, I had to go to "Build Settings" and check "Embedded Content Contains Swift Code" to YES.
By default it is set to NO.
Followed by cleaning and building. Enjoy!
The following has worked for me:
"Embedded Content Contains Swift Code" to YES
Clean
Rebuild
(I suspect, although I cannot prove, that it's really the Clean that fixes this.)

Could not instantiate class named MKMapView

I may be doing something really stupid here as I've done it before and it worked and now...
Created a new iPad project, in the details view I added a MKMapView, added the MapKit.framework to the project, added the property / etc. to the header. Go to run the project and get a SIGABRT with
****Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate
class named MKMapView'**
I found http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial/ but, like I said, I've already added framework. What am I missing?
I ran into this too, but I was able to get past it by following the instructions of step 2 in your link (thanks, by the way):
Add the MapKit framework to the project. (Control + Click Frameworks
folder -> Add -> Existing Frameworks)
I just searched for MapKit.framework, added it to the project, and the error went away.
I haven't added any map code yet (although I do have a MapViewDelegate connected in IB), but it's working fine so far!
Click on your project to bring the project settings. Under Targets, click your project, select from the upper toolbar "Build Phases". Under "Link binary With Libraries" tab, you will see the list of frameworks included in your project. Click the "+" button and add MapKit library from the shown list to your project.
For Xcode 6.1:
Select your project
In general tab, look for Linked Frameworks and Libraries (last one)
Press + button
Search MapKit.framework
Finally add
Easy way!
Works above Xcode version 7.2
As far as I'm concerned selecting the MAPS from capabilities will automatically link your framework to your project all you have to do is check the Maps button in Capabilities -> Maps.
Heres the attached screenshot. Cheers!!
For xCode 4.2:
Click on your project name ->targets ->building Phase ->link binary with library
-> click on + sign ->select mapKit.framework ->click add
I noticed that I was getting this message (on top of the original one mentioned in this post) when I was building and running on the simulator:
ld: warning: ignoring file
/Users/peter/programming/iPhone/iNspector/MapKit.framework/MapKit,
file was built for unsupported file format which is not the
architecture being linked (i386)
Then I just connected my iPhone, build and ran on the device, and the map worked.
So it seems that the MapKit framework cannot be compiled on the 386 architecture, it needs the device.
In regards to #futureshocked's input, I also came across the
Id: warning: ignoring file /blah.../MapKit, file was built for unsupported file format which is not the architecture being linked (i386)
issue.
**Check to make sure you didn't copy the MapKit framework into your local project directory when you added it to your project. I accidentally did this and XCode was giving me the above error. So I removed it from my project directory (in Finder), recompiled, and everything was normal again.
If you don't have the Framework in your project, go ahead and re-link as stated in the answer above.
Found a good tutorial on getting started with MapKit:
http://www.youtube.com/watch?v=X-3jM24EIGM&feature=related
I also received this error when trying to deploy to my 5.1 phone (with XC 4.5), even after changing my deployment target to be 5.1. Looks like the maps update wouldn't fly since I still had Google Maps on my phone. After updating my phone's OS, the exception disappeared.
Please import the WebKit at your Build Phases.

Resources