问题
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
回答1:
Just try:
#import <Mapbox/Mapbox.h>
instead of just importing Mapbox.h as suggested here: https://www.mapbox.com/blog/ios-sdk-framework
回答2:
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.)
回答3:
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.
回答4:
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!
回答5:
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.
来源:https://stackoverflow.com/questions/12983260/mapbox-ios-sdk-within-your-own-xcode