Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

ios - how to correctly build an app for device and simulator that conditionally uses the correct framework. (not a universal/fat framework)

Have obtained separate frameworks for device and simulator, and I want to integrate those frameworks to achieve the desired functionality. I have included the simulator framework in my carthage framework project. When I am compiling my framework, I am getting the following error

building for iOS-armv7 but attempting to link with file built for iOS-arm64 Undefined symbols for architecture armv7: "OBJCCLASS$...", referenced from: objc-class-ref in ViewController.o "OBJCCLASS$...", referenced from: objc-class-ref in DepedencyInjector.o objc-class-ref in ViewController.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

reference: https://developer.apple.com/forums/thread/66978 https://developer.apple.com/forums/thread/66978?answerId=215100022#215100022


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can build a XCFramework as follows (from the command line).

xcodebuild 
    -create-xcframework 
    -framework  "<<path to simulator xcarchive>>/Products/Library/Frameworks/SomeFramework.framework" 
    -framework  "<<path to device xcarchive>>/Products/Library/Frameworks/SomeFramework.framework" 
    -output     "CombinedFramework.xcframework"

You can add more to this and set the various paths and output to taste.

Not sure if this helps as you are not looking for universal frameworks and not sure how you classify this one ...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...