Xcode 10中使用KonyUIContext遇arm64架构未定义符号问题求助
KonyUIContext未定义符号的问题 Hey there, let's work through this linker error you're hitting with your Kony iOS FFI code.
First, let's recap what's happening: you're trying to present a view controller from your Kony form using KonyUIContext, but the linker can't locate the symbols for this class when building for the arm64 architecture. Here's how to troubleshoot and fix this step by step:
1. Confirm the Kony SDK library is linked to your project
This is the most common root cause of the "undefined symbols" error—your Xcode project isn't linking against the Kony SDK framework that contains KonyUIContext:
- Open your Xcode project, navigate to your target's Build Phases tab.
- Under Link Binary With Libraries, check if
KonySDK.framework(or the relevant Kony core library) is listed. If not, click the+button to add it to the list. - Verify the framework supports arm64: right-click the framework in Finder, then run
lipo -info [path-to-framework]/KonySDKin Terminal to confirm arm64 is included in the supported architectures.
2. Check header imports and search paths
Make sure your KonySupportClass is importing the correct header for KonyUIContext:
#import <KonySDK/KonyUIContext.h>
If you're using a static library instead of a framework, double-check that the path to Kony's header files is added to your target's Build Settings > Header Search Paths. Ensure the path is set correctly (use the recursive option if needed) so the compiler can find KonyUIContext.h.
3. Verify SDK version compatibility
It's possible the Kony SDK version you're using doesn't include KonyUIContext, or the API has been renamed. Check the documentation for your specific SDK version to confirm that KonyUIContext and the onCurrentFormControllerPresentModalViewController:animated: method are available.
4. Clean and rebuild your project
Build cache can sometimes cause odd linker issues. Try these steps to clear it:
- Delete Xcode's Derived Data: go to Xcode > Preferences > Locations > Derived Data, click the arrow to open the folder, then delete its contents.
- Use
Cmd+Shift+Kto clean the build folder. - Rebuild your project from scratch.
For reference, here's your code snippet:
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UINavigationController *navVC = [storyBoard instantiateInitialViewController]; [KonyUIContext onCurrentFormControllerPresentModalViewController:navVC animated:NO];
And the error you encountered:
Undefined symbols for architecture arm64:
"OBJC_CLASS$_KonyUIContext", referenced from:
objc-class-ref in KonySupportClass.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Give these steps a shot—chances are the issue is a missing framework link or incorrect header setup. Let me know if you're still stuck after checking these!
内容的提问来源于stack exchange,提问作者user4261201

