9

With Xcode 4 and the iOS 6 SDK in order to make use of the classes in QuartzCore.framework you had to link against the QuartzCore.framework and #import <QuartzCore/QuartzCore.h>. This was fine and it made sense. I was happy with my view of the world :)

In Xcode 5 with the iOS 7 SDK the QuartzCore headers seem to be getting imported automatically. Using CA classes raises no warnings or linker errors.

My question is this:

Given that these headers are obviously being imported from somewhere and the library is being linked, how do I trace the source of the import and the linked framework? This is more just for my curiosity and to understand more about this process than to solve a specific problem.

Additional Information:

  • Modules are switched on (by default in Xcode 5) but @import is not being used in any of the code. However, switching Enable Modules (C and Objective-C) and Link Frameworks Automatically both to be "No" does not seem to require the #import of QuartzCore to compile.
  • Once modules are switched off, viewing Product | Perform Action | Preprocess shows the QuartzCore header in the preprocessed output. This explains why the code compiles, but not where it came from.
  • otool shows nothing of the QuartzCore framework in its output:

    $ 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)
    

Edited with a partial solution

  • I figured out the source of the #import at least. Checking through the iOS 7 UIKit headers, UISlider now includes an import of <QuartzCore/QuartzCore.h> which was not there in iOS 6. Mystery one solved, but the lack of linker errors is still curious.
3
  • Maybe with the import for UISlider all of QuartzCore is now linked into UIKit? I'm looking now at the frameworks and QuartzCore is 6.7MB while UIKit is 40.4MB! I doubt that Apple could have allowed for such a huge oversight, and I don't know what the sizes are for iPhoneOS6.0SDK. Also, I've had multiple definition linker errors in the past and I guess that would probably happen if this was the case.
    – Guy Kogus
    Commented Oct 15, 2013 at 10:32
  • 2
    P.S. I love your weekly e-mails. You rock!
    – Guy Kogus
    Commented Oct 15, 2013 at 10:35
  • What does the linker command line look like?
    – petert
    Commented Oct 15, 2013 at 10:44

1 Answer 1

2

Looks like it is being linked by UIKit, possibly with LC_REEXPORT_DYLIB.

More information on this Twitter thread: https://twitter.com/daveverwer/status/390060215221354496

Running otool on UIKit.framework shows that it is linked.

$ 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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.