有没有会 Mac 开发的大佬,求助编译运行错误

2023-05-09 18:33:21 +08:00
 tpxcer

故事是这样的,我在用一个开源软件DevToys,使用过程中发现一个 Bug ,然后开发者已经消失大半年了,所以打算自己修改。但是作为 0 基础 Mac 开发小白,虽然找到了有问题的代码段,但是我运行的时候报错了,搜了一圈似乎不太像是缺少库,好像是去签名问题。(我自然没什么签名了)

我把要签名的地方都选成了 Sign to Run Locally 。。。但还是报错,这下不知道要怎么处理了。Sparkle 这个看起来像是弄 mac 软件更新的。我看 Package Dependencies 里面又有她 Sparkle 2.1.0,迷茫了,老铁们求助

dyld[21502]: Library not loaded: @rpath/Sparkle.framework/Versions/B/Sparkle
  Referenced from: <F062C5E2-9437-36C7-94AF-91A87E2F8850> /Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/DevToys.app/Contents/MacOS/DevToys
  Reason: tried: '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/Sparkle.framework/Versions/B/Sparkle' (code signature in <E31C20B8-205C-398E-97D3-833E34BFD904> '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/Sparkle.framework/Versions/B/Sparkle' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/usr/lib/swift/Sparkle.framework/Versions/B/Sparkle' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/DevToys.app/Contents/Frameworks/Sparkle.framework/Versions/B/Sparkle' (code signature in <E31C20B8-205C-398E-97D3-833E34BFD904> '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/DevToys.app/Contents/Frameworks/Sparkle.framework/Versions/B/Sparkle' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/usr/lib/swift/Sparkle.framework/Versions/B/Sparkle' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/DevToys.app/Contents/Frameworks/Sparkle.framework/Versions/B/Sparkle' (code signature in <E31C20B8-205C-398E-97D3-833E34BFD904> '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/DevToys.app/Contents/Frameworks/Sparkle.framework/Versions/B/Sparkle' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu/Build/Products/Debug/PackageFrameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/Library/Frameworks/Sparkle.framework/Versions/B/Sparkle' (no such file), '/System/Library/Frameworks/Sparkle.framework/Versions/B/Sparkle' (no such file, not in dyld cache)
1863 次点击
所在节点    macOS
12 条回复
razaro
2023-05-09 19:57:11 +08:00
把错误代码喂给 GPT-4 ,是这么说的,不知道对不对。
It appears that the Sparkle framework is not being loaded properly. The error message indicates that the library is not found at any of the paths it's trying to search for. Also, the code signature is not valid for use in the process. Here are some steps to resolve this issue:

Check if the Sparkle framework is added to your project correctly:
a. In Xcode, select your project in the Project Navigator.
b. In the "General" tab, scroll down to the "Frameworks, Libraries, and Embedded Content" section.
c. Make sure Sparkle.framework is listed. If it's not, click on the "+" button and add the Sparkle framework.

Make sure Sparkle framework is embedded in your app:
a. In Xcode, select your project in the Project Navigator.
b. Go to the "Build Phases" tab.
c. In the "Embed Frameworks" phase, check if Sparkle.framework is present. If not, add it.

Code signing issues can occur if the Team ID is not set or the binary is signed with a custom identity or ad hoc. Verify your code signing settings:
a. In Xcode, select your project in the Project Navigator.
b. Go to the "Signing & Capabilities" tab.
c. Make sure "Automatically manage signing" is enabled and your team is selected.
d. Check if the "Signing Certificate" is set to a valid option (e.g., "Development" or "Distribution").

Clean the build folder and derived data:
a. In Xcode, go to "Product" > "Clean Build Folder" in the menu bar.
b. Close Xcode and delete the DerivedData folder for your project. You can find its path in the error message you provided:
"/Users/haseochen/Library/Developer/Xcode/DerivedData/DevToys-btgymifvomgazifyksowkrjsikxu"

Restart Xcode and build your project again.

If the issue persists, you might consider re-downloading the Sparkle framework and adding it to your project again. Make sure you're using the correct version of the framework compatible with your project.
ferrum
2023-05-09 20:28:00 +08:00
不太了解 Sparkle 这个框架,但看报错信息,像是 Sparkle 需要 Team ID 才能正常工作,不能 run locally 。

你就直接把这个框架删了,然后把相关的引用也删了,反正也是个在线更新的框架,不影响功能。
weeei
2023-05-09 20:33:05 +08:00
没遇到你说的问题,可以顺利 run 起来。
你把依赖都下载回来了吗?
weeei
2023-05-09 20:38:32 +08:00
解决方案:移除 Sparkle ,然后把 CoreUtils 类型改成 Static ,去掉 Embed 。直接编译就能运行了。
weeei
2023-05-09 22:04:34 +08:00
weeei
2023-05-09 22:05:04 +08:00
打包好了,签名了。
xtinput
2023-05-09 23:23:09 +08:00
Sparkle 是应用程序自动升级的,删了不影响程序功能
tpxcer
2023-05-10 10:15:58 +08:00
@weeei 怎么下载,其实我怎么删都不知道,没接触过 2333
weeei
2023-05-10 12:29:15 +08:00
@tpxcer 链接: https://pan.baidu.com/s/1k7mfx6E8GG8pj_YnMJh6Ew?pwd=82b2 提取码: 82b2 复制这段内容后打开百度网盘手机 App ,操作更方便哦
tpxcer
2023-05-10 16:09:16 +08:00
@weeei 额我指的是依赖下载,老铁方便加个微信么,之前没接触过= = 迷茫中,只要能跑起来就行
tpxcer
2023-05-10 17:33:32 +08:00
@weeei 你是不是本身就是开发者,所以它能过?
tpxcer
2023-05-10 18:39:17 +08:00
@weeei 搞定了自己建个账号就行了= =

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/938680

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX