Undefined symbol for architecture i386 compile error caused by CACurrentMediaTime()

后端 未结 2 2010
时光取名叫无心
时光取名叫无心 2021-01-17 10:06

I\'m making an iOS application displaying a timer. I don\'t think I can keep the timer running after the user presses the home button, so I want to record the time when the

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 10:28

    You need to link QuartzCore.framework. That's where CACurrentMediaTime comes from: http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/CoreAnimation_functions/Reference/reference.html

    See this document on how to add frameworks: https://developer.apple.com/library/ios/#recipes/xcode_help-project_editor/Articles/AddingaLibrarytoaTarget.html#//apple_ref/doc/uid/TP40010155-CH17-SW1

    edit: To clarify, while you are correct in needing to include/import QuartzCore, you also need to link against it, which is related, but different. See Compiling and Linking

提交回复
热议问题