gpt4 book ai didi

Flutter:添加共享扩展

转载 作者:IT王子 更新时间:2023-10-29 06:42:02 26 4
gpt4 key购买 nike

问题

我已经将 iOS Share Extension 添加到一个非常简单的 Flutter 项目中,

My codefeature branch 上使用设备进行设置, 我也知道 bitcode in flutter is not ready yet :

在设备上运行Target: Share Extension

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: The Container App

注意:此[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 中的脚本?

知道怎么做吗?

更新

Target: Share Extension 中覆盖设置后:

  • LIBRARY_SEARCH_PATHS = "";
  • OTHER_LDFLAGS = ""; or OTHER_LDFLAGS = "-ObjC";

在设备上运行 Target: ShareExtensionTarget: The Container App 都可以。

最佳答案

所以 @pulyaevskiy的帮助。我找到了修复:

简短:

overwriteTarget: Share Extension 中设置: (git diff sample )

LIBRARY_SEARCH_PATHS = "";

OTHER_LDFLAGS = ""; or OTHER_LDFLAGS = "-ObjC";

详情:

  1. 位置:运行时Target: ShareExtension & Target: Container App都出错,只是因为添加了 Target: Share Extension .这意味着错误主要来自 Target: ShareExtension .

  2. 列出命令详细信息:

[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)
  1. 于是搜索Target: ShareExtension的设置 FMDB ,有 3 个结果:

    1. Other Linker Flags:-l"FMDB"
    2. Header Search Flags:"${PODS_ROOT}/Headers/Public/FMDB"
    3. Library Search Flags:"${PODS_CONFIGURATION_BUILD_DIR}/FMDB"
  2. Library Search Flags是一个像DerivedData/Products/Debug-iphoneos/FMDB/libFMDB.a的路径吗? ,所以我overwrite它与 "" , git diff 的结果是添加新行: LIBRARY_SEARCH_PATHS = "";

  3. 运行 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
  1. 搜索 FMDB再次,我猜 Other Linker Flags : -l"FMDB"就像 -lFMDB 的错误,所以我overwrite它与 "" (或离开 "-ObjC" ),导致 git diff 是 add a new line: OTHER_LDFLAGS = "";OTHER_LDFLAGS = "-ObjC"; .

  2. 运行 Target: ShareExtension & Target: Container App现在两者都有效。

检查 change in git differ

enter image description here enter image description here enter image description here

关于Flutter:添加共享扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57442240/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com