gpt4 book ai didi

ios - 您将如何追溯导入框架的来源?

转载 作者:可可西里 更新时间:2023-11-01 02:58:53 25 4
gpt4 key购买 nike

在 Xcode 4 和 iOS 6 SDK 中,为了使用 QuartzCore.framework 中的类,您必须链接到 QuartzCore.framework 和 #import <QuartzCore/QuartzCore.h> .这很好,而且很有意义。我对自己的世界观很满意 :)

在带有 iOS 7 SDK 的 Xcode 5 中,QuartzCore header 似乎会自动导入。使用 CA 类不会引发警告或链接器错误。

我的问题是:

鉴于这些 header 显然是从某处导入的并且正在链接库,我如何跟踪导入的来源和链接的框架?这更多只是出于我的好奇心,更多地了解这个过程,而不是解决特定问题。

附加信息:

  • 模块已打开(在 Xcode 5 中默认),但 @import 未在任何代码中使用。然而,切换Enable Modules (C and Objective-C)Link Frameworks Automatically两者都是“否”似乎不需要 QuartzCore 的#import 来编译。
  • 关闭模块后,查看产品 |执行操作 |预处理在预处理输出中显示 QuartzCore header 。这解释了代码编译的原因,但不解释代码的来源。
  • otool在其输出中没有显示任何 QuartzCore 框架:

    $ otool -L Test 
    Test:
    /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics (compatibility version 64.0.0, current version 600.0.0)
    /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 2903.2.0)
    /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1047.20.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
    /usr/lib/libSystem.dylib (compatibility version 1.0.0, current version 111.0.0)

使用部分解决方案编辑

  • 我至少弄清楚了#import 的来源。检查 iOS 7 UIKit header ,UISlider 现在包含一个导入 <QuartzCore/QuartzCore.h>这在 iOS 6 中是不存在的。谜团之一解决了,但缺少链接器错误仍然令人好奇。

最佳答案

看起来它是由 UIKit 链接的,可能是 LC_REEXPORT_DYLIB。

有关此 Twitter 主题的更多信息:https://twitter.com/daveverwer/status/390060215221354496

在 UIKit.framework 上运行 otool 显示它已链接。

$ otool -L UIKit 
UIKit:
/System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 2380.17.0)
/System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/CoreVideo.framework/CoreVideo (compatibility version 1.2.0, current version 1.8.0)
/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/MobileAsset.framework/MobileAsset (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/TelephonyUtilities.framework/TelephonyUtilities (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/WebBookmarks.framework/WebBookmarks (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/BackBoardServices.framework/BackBoardServices (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/XPCObjects.framework/XPCObjects (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 49.1.0)
/System/Library/Frameworks/CoreImage.framework/CoreImage (compatibility version 1.0.0, current version 2.0.0)
/System/Library/Frameworks/Security.framework/Security (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/DictionaryServices.framework/DictionaryServices (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 993.0.0)
/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices (compatibility version 1.0.0, current version 14.0.0)
/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics (compatibility version 64.0.0, current version 600.0.0)
/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 793.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
/System/Library/Frameworks/ImageIO.framework/ImageIO (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/QuartzCore.framework/QuartzCore (compatibility version 1.2.0, current version 1.8.0)
/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport (compatibility version 1.0.0, current version 29.0.0)
/System/Library/Frameworks/CoreText.framework/CoreText (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices (compatibility version 1.0.0, current version 40.0.0)
/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 9.6.0)
/System/Library/PrivateFrameworks/WebKit.framework/WebKit (compatibility version 1.0.0, current version 536.26.0)
/System/Library/PrivateFrameworks/WebCore.framework/WebCore (compatibility version 1.0.0, current version 536.26.0)
/System/Library/PrivateFrameworks/ProofReader.framework/ProofReader (compatibility version 1.0.0, current version 180.0.0)
/System/Library/Frameworks/CFNetwork.framework/CFNetwork (compatibility version 1.0.0, current version 609.1.4)
/usr/lib/libAccessibility.dylib (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Accelerate.framework/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/System/Library/PrivateFrameworks/PrintKit.framework/PrintKit (compatibility version 1.0.0, current version 109.2.0)
/usr/lib/libMobileGestalt.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libSystem.dylib (compatibility version 1.0.0, current version 125.0.0)

关于ios - 您将如何追溯导入框架的来源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19378557/

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