【问题标题】:Linker error when trying to use MPMoviePlayer尝试使用 MPMoviePlayer 时出现链接器错误
【发布时间】:2009-02-28 11:51:15
【问题描述】:

在全新安装 Xcode 3.1.2 时,我正在尝试使用 iPhone MoviePlayer,如 http://developer.apple.com/iphone/library/codinghowtos/AudioAndVideo/index.html#INITIATE_VIDEO_PLAYBACK_IN_MY_CODE 的示例代码所示

但是,当我尝试 build-n-go 时,Xcode 会报告以下链接器错误:

使用配置“Debug”构建项目“EOY”的目标“EOY”——(2 个错误) cd /Users/ed/dev/EOY setenv MACOSX_DEPLOYMENT_TARGET 10.5 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk -L/Users/ed/dev/ EOY/build/Debug-iphonesimulator -F/Users/ed/dev/EOY/build/Debug-iphonesimulator -filelist /Users/ed/dev/EOY/build/EOY.build/Debug-iphonesimulator/EOY.build/Objects- normal/i386/EOY.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/ed/dev/EOY/build/Debug-iphonesimulator/EOY.app/EOY 未定义的符号: “.objc_class_name_MPMoviePlayerController”,引用自: MediaSupport.o 中的文字指针@__OBJC@__cls_refs@MPMoviePlayerController “_MPMoviePlayerPlaybackDidFinishNotification”,引用自: MediaSupport.o 中的 _MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr ld:未找到符号 collect2: ld 返回 1 个退出状态 “.objc_class_name_MPMoviePlayerController”,引用自: MediaSupport.o 中的文字指针@__OBJC@__cls_refs@MPMoviePlayerController “_MPMoviePlayerPlaybackDidFinishNotification”,引用自: MediaSupport.o 中的 _MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr ld:未找到符号 collect2: ld 返回 1 个退出状态 构建失败(2 个错误)

【问题讨论】:

    标签: iphone xcode linker


    【解决方案1】:

    没错。另一种方法是通过选择 TARGETS->Build Phases->Link Binary with Libraries(此处添加 MediaPlayer)将 MediaPlayer 添加到项目目标

    【讨论】:

      【解决方案2】:

      是的,如果您的代码调用了一个框架,您必须将该框架添加到您的目标并链接到它。

      确保框架是“相对于当前 SDK”(选择框架 > 获取信息 > 常规选项卡),以便在为设备构建时,它链接到设备的版本,而不是模拟器的版本。

      【讨论】:

        【解决方案3】:

        发现问题。我没有阅读所有文档,但其中有很多...

        无论如何,我通过拖动目录解决了这个问题

        /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System/Library/Frameworks/MediaPlayer.framework/

        进入 XCode 中的 Frameworks 文件夹,然后在导入对话框中单击“确定”。

        【讨论】:

          猜你喜欢
          • 2012-01-15
          • 1970-01-01
          • 2013-06-21
          • 1970-01-01
          • 2013-10-25
          • 1970-01-01
          • 1970-01-01
          • 2019-11-07
          • 1970-01-01
          相关资源
          最近更新 更多