问题
I'm writing an app that using external libraries through CocoaPods such as AFNetworking, ReactiveCocoa etc, and one static library that I wrote before. The static library also contains some external libraries from CocoaPods as well.
I've made my static library an local pod of CocoaPods and imported it as one of my pods.
However, while compiling my new app, error happened.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_YADAClientManager", referenced from:
objc-class-ref in DZPAppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
YADAClientManager
is one class of my static library, and the only code that using it in my new app is in the DZPAppDelegate.m, in application:didFinishLaunchingWithOptions:
[YADAClientManager sharedClientManager];
How to solve this compiling error? And thanks in advance.
Edit:
In the Build Phrase of my app target, the Link Binary With Libraries option, I added the *.a file of my static library, such as libPods-MyApp-MyStaticLibrary.a, the problem above solved but another problem that reported missing AFNetworking
and ReactiveCocoa
symbols appeared.
After I added the *.a files of those libraries, problem solved.
But I do not think it is an elegant way to solve the problem.
回答1:
I was running into a similar issue: Modified Pod not getting compiled
I managed to find out that my Pod's source files and static library (.a) were cached in this path:
/Users/'<'username'>'/Library/Developer/Xcode/DerivedData/Example-gdaxkniovwphxbdlndbmlfqn/Build/Products/Debug-iphoneos
This path is also mentioned in your Target's : "Build Settings"> "Search Paths" > "Framework Search Paths".
I removed those cached files and my Pod was re-built with the new symbols. Took me 2 days to debug.
来源:https://stackoverflow.com/questions/23222887/compiling-error-with-local-cocoapods-pod