Add Files to "Quickstart"..., add the following projects to the workspace from the libraries you cloned in the previous step: google-api-objectivec-client/Source/GTL.xcodeproj
--> There isn't any GTL.codeproj, there is GTLCore.xcodeproj instead.
This makes it impossible to reproduce the following steps in the tutorial:
d- Select the "GTL" project's "GTLTouchStaticLib" target and make the following changes:
Add the library GTMSessionFetcher/libGTMSessionFetcherLib.a to Build Phases > Link Binary with Libraries.
e- Delete the "GTL" project's "GTLFramework" target.
f- In the Project navigator, delete GTL project's GTL Source > Common > HTTPFetcher group.
Check out the code. To do this, you can just run svn checkout
http://google-api-objectivec-client.googlecode.com/svn/trunk/
google-api-objectivec-client-read-only from your terminal. I will
refer to this code as "Google's code".
Go to your project's Build Phases. Expand "Link Binary With
Libraries" and add Security.framework and
SystemConfiguration.framework. These two are required by Google's
code.
Go to your project's Build Settings. Using the search box there,
look for Other Linker Flags (make sure "All" is selected to the left
of the search box). Add -ObjC -all_load.
Now search for User headers search path and add the full path to
Google's /Source directory. Make sure you select recursively.
Using Finder, go to Google's /Source/OAuth2/Touch directory. Drag
and drop GTMOAuth2ViewTouch.xib into your project.
Go back to Finder and go to Google's /Source directory. Drag and
drop GTLCommon_Sources.m and GTLCommon_Networking.m into your
project.
Now, you need to import the files for the services you want to use.
In my case, I need to use Google Drive, so I'll add those. In
finder, go to Google's /Source/Services/Drive/Generated directory.
Drag and drop GTLDrive.h and GTLDrive_Sources.m into your project.
If you want to use other services, go to their directory and import
the appropriate .h and .m file.
For some reason, Google's code doesn't use ARC, so if you try to
build right now, you will get ARC compile errors. So we need to
disable ARC for Google's code only. To do this, go back to your
project's Build Phases, but this time expand "Compile Sources". Make
sure that GTLCommon_Sources.m and GTLCommon_Networking.m are there.
Select them, press enter and type in -fno-objc-arc. This will
disable ARC for both of them. Make sure you don't add this option
for any other file (unless you know what you're doing).
You are done! Now, whenever you want to use Google's API, just
import GTMOAuth2ViewControllerTouch.h and your service header. In my
case, since I'm using Google Drive, I will also import GTLDrive.h.
Related
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"
I want to add the PLCrashFramework in my app. This frameworks deals with crash reporting for iOS/MAC applications. What I did
Downloaded and unzipped the .zip file from the URL I have already provided.
In Xcode "Build Phases" -> Link Binary With Libraries
From the pop up "Choose frameworks and libraries to add"
Select "Add Other"... and select "CrashReporter.framework" and Open
After those steps I successfully built the project without problems.
I closed the Xcode, opened it again and tried to build. The build failed with
"header file not found", referring to a header file that belongs to the framework.
Why the xcode 6 does not find the header after closing and reopening the project?
Check your Framework Search Paths and Library Search Paths in your project's Build Settings. Check if you have a space in your directory structure. It's probably looking for 2 folders, one with the first part of the folder structure and one with the second. To fix this, simply add quotes around the whole folder structure.
You should add the framework though add file in project navigator by right click and select add file in your project and than browse to framework location and add framework. Remember to check copy file in your project it is must do. In this way Xcode will manage library header search path. You can see the framework will be added in Xcode "Build Phases" -> Link Binary With Libraries. If it is somehow not there you can add it by dragging framework from project navigator. The error will be gone.
I want to use facebook pop, but I don't know how to embed it into my project. My project isn't workspace and no cocoapods, I just want to add them directly. Anybody help?
I just did this, so here are stepwise instructions. (Basically, expanding on the README which says: "By adding the project to your project and adding pop.embedded framework to the Embedded Binaries section on the General tab of your app's target, you can set up pop in seconds!")
Clone the library into a directory accessible from your app's project:
git clone https://github.com/facebook/pop.git
Open a Finder window into the newly cloned pop directory.
Drag the pop.xcodeproj file into your app's project navigator, inside your app's .xcodeproj.
Go to your app's project, select your target, select the General tab:
Under Embedded Binaries, add the Facebook pop framework. There are two on the list, one for iOS, the other for OS X. Because Xcode, the names are undifferentiated.
Verify you selected the correct one by looking at the path in the Embedded Binaries section after adding it.
Use the pop framework by adding an #import pop; to whatever view controller you want to use it in.
"... manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including -lc++ to your project linker flags."
Do you see that introduction?
I'd like to install facebook's pop framework. I have a multi-project workspace which is not using cocoa pods. I want just the simplest, dumbest, quickest install.
From the pop readme:
"... you can add the project to your workspace and adopt the provided configuration files or manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including -lc++ to your project linker flags."
I added pop.xcodeproj to my workspace.
I added "pop.framework" to to
the project that needs pop (general > linked frameworks and libraries).
I added "-lc++" to my project linked flags (in the project that needs pop).
Added #import <POP/POP.h> to my .m file.
The result: "POP/POP.h" not found.
I guess I'm doing something wrong, but absolutely no idea where to start looking.
I set the Built Setting of my project, then it worked.
User Header Search Paths = $(SRCROOT) // recursive. Pop is placed in the directory
Always Search User Paths = YES
This setting worked for me:
in podfile:
pod 'pop'
in project > target > build settings
always search user paths YES
add search path:
Take a look at this:
How to add facebook open source code pop to project directly
I also discovered that the -lc++ flag actually caused a linker error. I followed the instructions in that link and removed the flag and everything worked!
You could try this...worked for me as I'm also adding pop as static library, instead of using CocoaPods:
Download source code from this tutorial, because we'll be adding the library files with quotes "POP/POP.h" instead of < POP/POP.h > and all files are already changed here, just copy/paste the "pop" folder from the example project to your project: http://tapity.com/tutorial-getting-started-with-pop/ You can alternatively change all files you already have inserting quotes.
In your project create a subdirectory called "pop" (File/New/Group) with another subdirectory inside called "WebCore". It's important that you create these subdirectories so they will appear as yellow "folders" (instead of blue folders) and Xcode will compile the files properly. You can check if POP files are being included in Build Phases / Compile Sources.
Add the respective POP files inside these empty subdirectories respecting the same structure of the source project (i.e. File/Add Files to "project" inside each subdirectory).
Now just #import "POP/POP.h" and start using pop animations. Doing this way there's no need to add pop.xcodeproj to your workspace.
After trying all of these solutions, what worked for me was actually was lowering the Deployment Target from 9.3 to 8.0.
Be careful of the order of your framework search paths. I had another project which I was referencing modules from that had a different version of the framework library and because that project was higher in the framework search path ranking it was picking up the incorrect header files too.
Those who suffers from it. My problem was like this,
I was having trouble with swift and xcode 8 build times. So i changed my scheme Edit Scheme -> Build -> Find Implicit Dependencies (Uncheck). I was not get trouble with simulator i was having trouble with device. So when i change it to check again it worked. And then made uncheck or vice versa.
I downloaded MapBox example from github using the following
git clone --recursive https://github.com/mapbox/mapbox-ios-example.git
Which downloaded it including all dependencies. Now I'm trying to create a separate project and include MapBox DSK as it was in that example. I tried creating workspace then creating a single view project then add new file and select .xcodepro for the MapBox DSK but didn't work when I tried importing MapBox.h file. I never tried importing 3rd parties API before and a bit not sure how I can do that correctly. Any Idea how I can accomplish that ?
Thanks in Advance
Just try:
#import <Mapbox/Mapbox.h>
instead of just importing Mapbox.h as suggested here:
https://www.mapbox.com/blog/ios-sdk-framework
You simply drag the Mapbox-ios-sdk project file from Finder to the files pane in Xcode.
And then click the project in Xcode files pane, Target-->Build Settings. Search for "User Header Search Paths". Specify where the MapBox sdk is located.
What I do is I put the MapBox-iOS-sdk in my project directory. And I set the path as $(SRCROOT) and make sure to set it as recursive.
While you're at it also make sure -ObjC and -all_load are set in Other linker flags.
That only helps you reference the .h files, to link, also under Build Setting, Link Binary with Libraries you need libMapBox.a.
If there is a MapBox.bundle (as in the latest development branch) in the group and files pane, you want to drag that into Target->Build phases->Copy bundle resources as well. (The add button doesn't work for me.)
I think the best way is to look at mapbox-ios-example provided by MapBox and try to replicate all dependencies into your own project.
A bit late but I did it like it was explained here: http://mapbox.com/mapbox-ios-sdk/#binary.
Not messing around with git, just dragging things into your project, easy!
I think problem here is he couldn't find a specific 'file' that was titled "MapBox.Framework" inside the folder of resources downloaded from Map Box, however what you actually need to do is copy that whole folder, which is titled "MapBox.Framework" into the frameworks section. I think the confusion was that the main folder that needs to be copied doesn't look like the yellow framework icon until you copy that folder into Xcode's frameworks section.