问题
When building and testing in Xcode and running the app on let's say, ipad and then want to switch to iphone, I get the following build errors:
ld: warning: ignoring file /xxx/Build/Products/Debug- iphoneos/libCTCheckbox.a, file was built for archive which is not the architecture being linked (arm64): /xxx/Library/Developer/Xcode/DerivedData/xxx/Build/Products/Debug-iphoneos/libCTCheckbox.a
for all my pod libraries.
And then:
Undefined symbols for architecture arm64: "_OBJC_CLASS_$_RKObjectMapping", referenced from: objc-class-ref in MappingGenerator.o objc-class-ref in SyncingManager.o
for a whole bunch of files.
This started happening after I did a Cocoapods upgrade to version 1.0.1 and ran a pod install.
In XCode (version 8.0 ) my build settings for the project, project target and Pods project are set to:
- Architectures: Standard architectures(armv7, arm64)
- Build Active Architectures Only: Debug -> YES, Release -> NO
- Valid Architectures: armv7, armv7s, arm64
- Target Device Family: 1,2
- Library Search Path: $(inherited), "${PODS_ROOT}/GoogleAnalytics/Libraries"
- Framework Search Paths: $(inherited)
When I play around with the "Build Active Architectures Only" setting and Clean the Project and restart XCode, eventually the build succeeds again but I haven't found a reliable order of actions that works. When I want to switch back to ipad the same thing happens again.
回答1:
Apologies for the duplicate issue, looks like I solved it by deleting everything in DerivedData, see CocoaPods libraries errors building for some iOS simulators
来源:https://stackoverflow.com/questions/40036842/xcode-build-fails-when-switching-from-iphone-to-pad-or-vice-versa