.framework方式
该方式只能看到.h文件,不能看也不能修改源码,有一定的局限性
以DropboxSDK为例
Adding DropboxSDK to your project:
- Open your project in Xcode
- Right-click on your project in the files tab of the left pane and select "Add Files to '<PROJECT_NAME>'"
- Navigate to where you uncompressed the Dropbox SDK and select the DropboxSDK.framework subfolder
- Select "Copy items into destination group's folder"
- Press Add button
- Ensure that you have the Security.framework and QuartzCore.framework are added to your project. To do this in Xcode4, select your project file in the file explorer, select your target, and select the "Build Phases" sub-tab. Under "Link Binary with Libraries", press the + button, select Security.framework, and press Add. Repeat for QuartzCore.framework if necessary.
- Build your application. At this point you should have no build failures or warnings
.xcodeproj方式
还是以DropboxSDK为例该方式较上一种方式更灵活,不仅可以读源码,还可直接修改代码,debug到代码中
- 到项目的根目录下
- 创建ThirdpartyLib文件夹
- 把包含DropboxSDK项目(DropboxSDK.xcodeproj)的文件夹copy过去
- 直接从Finder中把.xcodeproj文件拖到xcode的项目目录下
- 在targets - Build Settings - Search Paths - User Header Search Paths中加入对应path $(PROJECT_DIR)/Thirdparty
注意事项:如果在升级库文件后,提示有错,可以把libaray - xcode下面的缓存文件删除