How to embed Cocoa Touch Framework in Xcode 7 - ios

I try to add a test framework to a text app in Xcode 7, but it fails.
ld: framework not found TestUtility clang: error: linker command
failed with exit code 1 (use -v to see invocation)
Any idea what is going on? A have cleaned, removed subfolders in~/Library/Developer/Xcode/DerivedData.
I show some screen shot, but nothing special I have set. Here is an empty Cocoa Touch Framework built for iOS 9.
Here is the TestApp, set embedded as usual
And the error:

Follow these steps:
Create your custom framework in Xcode. Close it.
Create the project for your application. Close it.
Create a workspace for your application. Make sure that your project is added. If not, choose "Add files..." then add your *.xcodeproj
Add your custom framework to your workspace using the same way in step 3.
In your workspace, click your application project and under the "TARGETS", choose your application project (scheme), expand the “Linked Frameworks and Libraries”
Drag your *.framework found under the tree of your custom framework in your workspace to the location stated in step 5
Enjoy! :)

Related

ld: library not found for -lVuforia

I'm integrating unity project to native ios project in c++. But I'm getting error
ld: library not found for -lVuforia
clang: error: linker command failed with exit code 1 (use -v to see invocation)
while building xcode project.
I'm using
xCode : 8.2.1
Unity : 5.6.1f1
It doesn't look like you have the "Vuforia" library included in your build.
Under your Unity project, look for a file called Vuforia.framework. This file's inspector should have "iOS" marked in it, so it gets included in the generated Xcode project.
If you integrated a Unity scene using Vuforia, you should be able to see those libraries libVuforia.a and libVuforiaUnityPlayer.a at the path Demo/Vendor/Unity/Libraries/Plugins/iOS/
If you don't see those libraries you should try to integrate your Unity scene once again. If they're here, in Xcode go to Build Phases, then Link Binary With Libraries and make sure you have those above libraries as well as libiPhone.a (those are the libraries given by your Unity scene and you definitely need them), if not add them.
Also, I believe you followed a tutorial to integrate a normal Unity scene, however when you use Vuforia you need to make some other steps. For instance, you'll have to add the folder references of Data AND QCAR. I recommend you to try once again your integration with this tutorial which is more relevant to what you want to do.
I hope this will be useful to you and I wish you good luck in your integration.
Because your code cannot find libVuforia.a, which is library. You have to set "Library search path" at "Build Setting"
or use vuforia sdk
1. download vuforia sdk https://developer.vuforia.com/downloads/sdk
2. create or put your source code put in Sample folder in vuforia-sdk-ios-7-0-43
enter image description here
3.In your project Go to Target > Build Setting > Search Paths > Library Search Path. and Click +
../../build/lib/arm
4.In your project Go to Target > Build Setting > Search Paths > Header Search Path. and Click +
../../build/include
5.Run

The frameworks' link path has changed after the project moved to another place

please take a look at the picture:
It's my project structure:
1 app(top one)
3 frameworks (create by myself)
1 cocoa pods static library(bottom one)
When I cmd+b, all the sub projects would be build start from the bottom one to the top one, here is no problem, everything are fine.
To refer/link the frameworks, I drop the framework product to every sub project's /Build Phases/Link Binary With Libraries and /Build Phases/Copy Files.
The problem is:
When I copy/move the project folder to another place (like ~/oldFolder/app to ~/newFolder/app) the sub project cannot finds the frameworks, it report Not Found Error, I need re-build and drop the framework product to link to fix the error.
It's too stupid and hard to work with other people, anyone can help?
p.s.: sorry for my poor english.
Add error pic:
You can use $(SRCROOT) if you want to refer paths relative to your source directory . $(SRCROOT) will point where your project files are . apple doc
An example :
if you have a directory x in your MyApp folder which contains your project file then the folder x can be reffered as $(SRCROOT)/x. Enter this in frameworks path section in Build settings to refer to your library .
This all boils down to you not being able to change the location of the already imported frameworks right? This is an example with the FBSDKCoreKit.framework. If I were to change the folder location I would need to change the relative path. Click on the folder Icon right next to the name and choose the new location
I post the detail of how to fix this issue on my side here:
In Framework:
set "$(SRCROOT)/../build" at item "Per-configuration Build Products Path" in Build Setting page;
shift+cmd+k to clean up the framework build, then cmd+b rebuild the framework;
In MyApp
add "$(SRCROOT)/../build" at item "Framework Search Path" in Build Setting page;
Drag the framework from the product of framework project to "Link Binary With Libraries" in Build Phases page;
Drag the framework from the product of framework project to "Copy Files" in Build Phases page(you can add the "Copy Files" item by
click the top left of Build Phases page);
Please note if you use one more framework in the same project, and the framework also links to another one like the sample I sent in my question, you also need to do all the steps as above I posted(Steps of Framework and App).
Another problem you will meet if you also use cocoapods in your project like my sample: After you done all the steps above, XCode will response error in your framework project like:
ld: framework not found Pods_xxx.framework
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The "xxx" should be your framework project name. To fix it, you just need remove the Pods_xxx.framework in your project/General/Linked Frameworks and Libraries. The error will be disappeared after you rebuild the project. Here you can find the detail of this problem.
p.s.: the Pods_xxx.framework will appear in General/Linked Frameworks and Libraries after you install pod, so you need remove it again if you run command "pod install"

How to integrate AdMob with Unity iOS project?

I have faced a problem where my game works fine but when I am trying to make it work with AdMob, it gives me error in Xcode.
The error is
ld: framework not found GoogleMobileAds
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
But my point is that I have imported the GoogleMobileAds framework and all the other frameworks what google developer site said, but it still doesn't work.
and this:
In Xcode select your Target, go to Build Settings, search for Search Paths.
It should give you 3 lists of directories - Header Search Paths, Framework Search Paths and Libary Search paths. In Framework Search Paths Make sure non of the directories have quotation marks "like this" and make sure the directory of your GoogleMobileAds.framework is listed. If not than add it.
If there is no GoogleMobileAds.framework file in your entire project than try to look with Finder (it may still be in the project repository but not linked to the project). If you can't find it than just copy it from Unity project Assets/Plugins/iOS/GoogleStuffDirectoryOrSomething/GoogleMobileAds.framework and paste it in Xcode project using Finder, then from Finder manually drag and drop it in Xcode so that project gets the reference to that file.
Build.
1.You have to drag and drop "GoogleMobileAds.jar" in your Xcode.
2.Then you have to add 2 frameworks(AdSupport,Storekit), and also have to add "GoogleMobileAds" plugin to Build Phase.
For more discriptive steps for integrate AdMob with iOS and Android both, follow the belove link.http://www.theappguruz.com/blog/ads-implementation-in-unity-using-admob

MyClass is unavailable: cannot find Swift declaration for this class

I am building a custom framework in swift.I have builded the framework for all the architecture. I am using Debug-Universal build in my sample app. Now when I run the app, It works fine in the simulator but while running on the device, I am getting the error Breeze is unavailable: cannot find Swift declaration for this class
When I am using Release-Universal it is giving No such Module BreezeSDK
Follow these steps after creating the universal binaries:
Before lipo, you are building .framework packages for the individual architectures.
For each package:
Traverse to abc.framework/Modules/abc
Copy files .swiftdoc
Go into universal abc
Traverse to abc.framework/Modules/abc
Paste the files you copied in step 2
Repeat these steps for all architectures.
Finally your universal framework package path abc.framework/Modules/abc.swiftmodule/ should contain
those files:
arm.swiftdoc
arm.swiftmodule
arm64.swiftdoc
arm64.swiftmodule
i386.swiftdoc
i386.swiftmodule
x86_64.swiftdoc
x86_64.swiftmodule
The Swift compiler needs swiftmodule map files for each architecture.
Follow these steps
Download Bareeze SDK.
Drag and add Breeze.xcodeproj to your project.
Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
In the tab bar at the top of that window, open the "General" panel.
Click on the + button under the "Embedded Binaries" section.
Select the top Breeze.framework
Hope this might solve the issue.

ld: framework not found Parse Xcode 7 beta

I succeed to install and use Parse framework with my new project, but I can't with a "template project".
The template is just a Slide Menu from Appcoda
You can download the project here.
I have this error :
ld: framework not found Parse
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And the same for Bolts.
I don't understand what the problem is, the initial project is just some View Controllers...
When I write the code "import Parse", the error message is :
No such module 'Parse'
I tried to drag and drop the frameworks, and also to add the frameworks in "Link Binary With Libraries".
PS : I am using Xcode 7 beta, and I tried on beta 1 and 2, same issue.
Here is the solution:
There seems to be an issue with Xcode 7 beta where the search path for manually added frameworks is missing.
To fix the issue add the search path by doing the following:
Select Project
Click on Targets
Click Build Settings
Search for: Framework Search Path
Add $(PROJECT_DIR) and choose Recursive option.
The project should build now.
Thanks to this post : Link to stack
None of the proposed solutions worked for me. Eventually I found that the solution was to drag the frameworks from a source folder that did not have spaces in it's name.
E.g.
Dragging the frameworks from 'iOS SDKS' > did not work
Dragging the frameworks from 'Downloads' > worked
It's not the first time that XCode has been shown to be problematic when working with paths that contain spaces.
Ensure that Parse is included in the "Link Binary With Libraries" section under "Build Phases".
Go to your Build Phases -> Linked Binary With Libraries remove your pod framework & add it back again. That does the trick.
Even I got the same issue. In my case, somehow there were multiple frameworks added to the project, and one of the framework is empty. After removing the empty framwork it started compiling.
This can also happen if you accidentally break your framework, e.g. if the framework contained an Alias, which is no longer there.
This can happen if you zip the file, as the Alias contains a direct link to the orignal file, and isnt updated when you move the zip. E.g. in my case I recieved a zip of the opencv framework, and inside it had just the 'Versions' folder and no aliases to Headers, Resources or the binary. You can just recreate the aliases, or compile the framework from source again.
This took a while to figure out!

Resources