Swift嵌入式库 -> 命令/usr/bin/codesign失败,退出代码为1

5

我正在尝试将Swift框架集成到我的项目中: http://developer.skobbler.com/download/SKMaps_iOS_2.4.0_withDemo_Swift.zip

当我尝试嵌入二进制文件进行集成时,Xcode无法对其进行代码签名,并显示“codesign failed with exit code 1”。

CodeSign /Users/k1x/Library/Developer/Xcode/DerivedData/TestMaps-dubiwcafqgeplbabdrqpjtokouxq/Build/Products/Debug-iphoneos/TestMaps.app/Frameworks/SKMaps.framework
    cd "/Users/k1x/Workspace iOS/SwitchMaps"
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "iPhone Developer"

    /usr/bin/codesign --force --sign 56131F60BE8DA3BA4F04CBF6717C75951E93E4D6 --preserve-metadata=identifier,entitlements,resource-rules /Users/k1x/Library/Developer/Xcode/DerivedData/TestMaps-dubiwcafqgeplbabdrqpjtokouxq/Build/Products/Debug-iphoneos/TestMaps.app/Frameworks/SKMaps.framework

Warning: usage of --preserve-metadata with option "resource-rules" (deprecated in Mac OS X >= 10.10)!
/Users/k1x/Library/Developer/Xcode/DerivedData/TestMaps-dubiwcafqgeplbabdrqpjtokouxq/Build/Products/Debug-iphoneos/TestMaps.app/Frameworks/SKMaps.framework: invalid resource specification rule(s)
Command /usr/bin/codesign failed with exit code 1

我尝试将框架放在“链接的框架和二进制文件部分”。但是我得到了以下输出:

dyld: Library not loaded: @rpath/SKMaps.framework/SKMaps
  Referenced from: /private/var/mobile/Containers/Bundle/Application/B3686F36-2120-4007-97AB-B2D3B423C0A0/TestMaps.app/TestMaps
  Reason: image not found

我在Google上搜索了一下这个问题,但是其他帖子都没有回答我的问题。 只是以防万一Objective C版本可以正常工作:http://developer.skobbler.com/download/SKMaps_iOS_2.4.0_withDemo.zip


我们正在调查此事。 - Ando
3个回答

1

您需要使用Cocoapods进行安装。

我曾经遇到过同样的问题,我喜欢这个解决方案,它有效。

编辑:使用CocoaPods,您需要在您的Podfile中添加一行包含pod 'ScoutMaps-iOS-SDK',在终端中运行pod install,并导入SKMaps/SKMaps.h头文件以使用库,或者如果您正在使用Swift,则将SKMaps/SKMaps.h头文件导入您的Objective-C桥接标头中。


你能否编辑你的回答,包括在链接文章中解决方案的摘要? - Oblivious Sage

0

从Frameworks文件夹中选择SKMaps.framework,然后取消选中并重新选中SKMapsSwiftDemo目标(在Target Membership中),如this screenshot所示。

在SDK的下一个版本中将不再需要此操作。


我使用的是XCode 6.3,我取消了勾选并重新勾选了复选框,但问题仍然存在。 - ik1
开发人员会尽快调查此事。 - SylviA
由于苹果公司不断更新Swift,这类错误将来很可能仍会发生。一个解决方案是:在自定义初始化器中调用super.init(nibName: nil, )。例如,在GPSFilesViewControler的init(fileName: String)中,我调用了super.init(nibName: nil, bundle: nil),而不是super.init()。在此处还可以查看其他解决方案:https://dev59.com/RV4b5IYBdhLWcg3wfx5J - SylviA
我们的开发人员提供了一个解决方案:对于dyld错误:“Library not loaded: @rpath/SKMaps.framework/SKMaps”,请选择您的目标,转到“General”选项卡,然后进入“embedded binaries”部分并添加SKMaps.framework。 对于codesign错误,请转到Build Phases添加SKMaps.framework并检查“Code Sign On Copy”选项。 - SylviA

0

针对这个问题:

dyld: Library not loaded: @rpath/SKMaps.framework/SKMapsReferenced from:
/private/var/mobile/Containers/Bundle/Application/
B3686F36-2120-4007-97ABB2D3B423C0A0/TestMaps.app/TestMaps
Reason: image not found

我遇到了同样的问题(从头开始的Swift项目)。

嵌入式二进制文件项目/目标/常规/嵌入式二进制文件)下添加SKMaps.framework就解决了这个问题:

Embedded Binaries

清理、构建、运行。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接