gpt4 book ai didi

objective-c - 如果框架从应用程序中删除,会发生什么情况?

转载 作者:太空狗 更新时间:2023-10-30 03:37:48 25 4
gpt4 key购买 nike

我被问到一个问题,如果从您的设备(可能是 iphone 或 mac)中意外删除了一个框架,会发生什么情况?

您的应用程序是崩溃了还是正常运行?

请给我提供解释的答案。

最佳答案

您可能会遇到链接错误。如果框架文件夹在应用程序内部意味着它的运行时链接。

OS X embeds an "install name" inside each dynamic library. This install name is the path to where the library can be found when dyld needs to load it. When you build an application that links against a dynamic library, this install name is copied into the application binary. When the application runs, the copied install name is then used to locate the library or framework.

   $ otool -D /Applications/Google\ Drive.app/Contents/Frameworks/Python.framework/Versions/2.6/Python 
/Applications/Google Drive.app/Contents/Frameworks/Python.framework/Versions/2.6/Python:
@executable_path/../Frameworks/Python.framework/Versions/2.6/Python

因此,如果您要删除 Frameworks 文件夹,您将收到 Dyld 错误。

Dyld Error Message:
Library not loaded: @loader_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle
Referenced from: /Applications/Transmission.app/Contents/MacOS/Transmission
Reason: image not found

enter image description here

enter image description here

关于objective-c - 如果框架从应用程序中删除,会发生什么情况?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15023498/

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