问题
我已将 iOS Share Extension
添加到一个非常简单的 Flutter 项目中,
My code在 feature branch 上设置设备,我也知道bitcode in flutter is not ready yet :
在设备上运行目标:共享扩展
ld: '[Project_Path]/ios/DerivedData/Products/Debug-iphoneos/FMDB/libFMDB.a(FMDatabase.o)'
does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting
ENABLE_BITCODE)
在设备上运行目标:容器应用
注意:此[CP] Embed Pods Framworks
与[ProjectCompare]
相同。
* Run custom shell script '[CP] Embed Pods Framworks'....
* Validate [Project_Path]/ios/DerivedData/Products/Debug-iphonos/Runner.app/PlugIns/
ShareExtension.appe(in target: Runner)
* cd [Project_Path]/ios
* builtin-embeddedBinaryValidationUtility [Project_Path]/ios/DerivedData/Products/
Debug-iphonos/Runner.app/PlugIns/ShareExtension.appex
-siging-cert [someID]
-info-plist-path [Project_Path]/ios/DerivedData/Products/Debug-iphonos/Runner.app/Info.plist
* error: Embedded binary is not signed with the same certificate as the parent app.
Verify the embedded binary target's code sign settings match the parent app's.
* Embedded Binary Signing Certificate: Not Code Signed
* Parent App Signing Certificate: iPhone Developer: MyName (XXXXX)
比较
我还创建了一个纯iOS项目ProjectCompare也一样,并在更改后将 Pod
添加到其中。我使用 workspace
打开项目并添加 Share Extension
,它在设备上运行良好。
问题
所以我认为可能是一些与 Flutter 设置相关的脚本导致了这个错误?或者 Podfile 中的脚本?
知道该怎么做吗?
更新
覆盖目标:共享扩展
中的设置后:
LIBRARY_SEARCH_PATHS
= "";OTHER_LDFLAGS
= ""; orOTHER_LDFLAGS
= "-ObjC";
在设备上运行目标:ShareExtension
和目标:容器应用程序
都可以工作。
最佳答案
所以@pulyaevskiy的帮助。我找到了修复方法:
简短:
overwrite
设置在Target: Share Extension
:(git diff sample)
LIBRARY_SEARCH_PATHS
= "";
OTHER_LDFLAGS
= ""; orOTHER_LDFLAGS
= "-ObjC";
详细信息:
位置:运行时
Target: ShareExtension
&Target: Container App
两者都会出错,只是因为添加Target: Share Extension
。 这意味着错误主要来自Target: ShareExtension
.列出命令详细信息:
[Clang Path]/clang -arch arm64 -isysroot
[iOS SDK Path]/iPhoneOS12.4.sdk
-L[Project Path]/ios/DerivedData/Products/Debug-iphoneos
-L[Project Path]/ios/DerivedData/Products/Debug-iphoneos/FMDB <-- this
-L[Project Path]/ios/DerivedData/Products/Debug-iphoneos/sqflite <-- this
-F[Project Path]/ios/DerivedData/Products/Debug-iphoneos
-F[Project Path]/ios/Pods/../.symlinks/flutter/ios
-filelist [Project Path]/ios/DerivedData/Build/Intermediates/Runner.build/Debug-iphoneos/ShareExtension.build/Objects-normal/arm64/ShareExtension.LinkFileList
-Xlinker
-rpath
-Xlinker @executable_path/Frameworks
-Xlinker
-rpath
-Xlinker @loader_path/Frameworks
-Xlinker
-rpath
-Xlinker @executable_path/Frameworks
-Xlinker
-rpath
-Xlinker
@executable_path/../../Frameworks
-miphoneos-version-min=12.4
-dead_strip
-Xlinker
-object_path_lto
-Xlinker [Project Path]/ios/DerivedData/Build/Intermediates/Runner.build/Debug-iphoneos/ShareExtension.build/Objects-normal/arm64/ShareExtension_lto.o
-Xlinker
-export_dynamic
-Xlinker
-no_deduplicate
-fembed-bitcode-marker
-fobjc-arc
-fobjc-link-runtime
-fapplication-extension
-ObjC
-lFMDB <-- this
-lsqflite <-- this
-lsqlite3 <-- this
-framework Flutter <-- this
-e _NSExtensionMain
-Xlinker
-dependency_info
-Xlinker [Project Path]/ios/DerivedData/Build/Intermediates/Runner.build/Debug-iphoneos/ShareExtension.build/Objects-normal/arm64/ShareExtension_dependency_info.dat
-o [Project Path]/ios/DerivedData/Products/Debug-iphoneos/ShareExtension.appex/ShareExtension
错误详细信息:
ld: '[Project_Path]/ios/DerivedData/Products/Debug-iphoneos/FMDB/libFMDB.a(FMDatabase.o)'
does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting
ENABLE_BITCODE)
所以搜索
Target: ShareExtension
的设置为FMDB
,有 3 个结果:Other Linker Flags
:-l"FMDB"
Header Search Flags
:"${PODS_ROOT}/Headers/Public/FMDB"
Library Search Flags
:"${PODS_CONFIGURATION_BUILD_DIR}/FMDB"
Library Search Flags
是像DerivedData/Products/Debug-iphoneos/FMDB/libFMDB.a
这样的路径吗? ,所以我overwrite
它与""
, git diff 的结果是添加新行:LIBRARY_SEARCH_PATHS = "";
运行
Target: ShareExtension
检查结果: 这两行命令详细信息不见了
-L[Project Path]/ios/DerivedData/Products/Debug-iphoneos/FMDB
-L[Project Path]/ios/DerivedData/Products/Debug-iphoneos/sqflite
错误变为(这也意味着上述更改有效):
ld: library not found for -lFMDB
搜索
FMDB
再次,我猜是Other Linker Flags
:-l"FMDB"
就像-lFMDB
的错误,所以我overwrite
它与""
(或左"-ObjC"
),git diff 的结果是 添加新行:OTHER_LDFLAGS = "";
或OTHER_LDFLAGS = "-ObjC";
.运行
Target: ShareExtension
&Target: Container App
现在两者都有效。
关于Flutter:添加共享扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57442240/