2009-02-28 67 views
2

在新鮮截至http://developer.apple.com/iphone/library/codinghowtos/AudioAndVideo/index.html#INITIATE_VIDEO_PLAYBACK_IN_MY_CODE鏈接錯誤,當試圖使用MPMoviePlayer

但是所示示例代碼的Xcode 3.1.2,我想使用iPhone MoviePlayer的安裝,Xcode中報告以下鏈接錯誤時我嘗試建立-n-go:

 
Building target 「EOY」 of project 「EOY」 with configuration 「Debug」 — (2 errors) 
     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 
Undefined symbols: 
    ".objc_class_name_MPMoviePlayerController", referenced from: 
     [email protected][email protected][email protected] in MediaSupport.o 
    "_MPMoviePlayerPlaybackDidFinishNotification", referenced from: 
     _MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in MediaSupport.o 
ld: symbol(s) not found 
collect2: ld returned 1 exit status 
      ".objc_class_name_MPMoviePlayerController", referenced from: 
       [email protected][email protected][email protected] in MediaSupport.o 
      "_MPMoviePlayerPlaybackDidFinishNotification", referenced from: 
       _MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in MediaSupport.o 
     ld: symbol(s) not found 
     collect2: ld returned 1 exit status 
Build failed (2 errors)

回答

2

這是正確的。另一種方法是將MediaPlayer添加到Project Target中,方法是選擇TARGETS-> Build Phases-> Link Binary with Libraries(這裏添加MediaPlayer)

0

發現問題。我沒有看過所有的文檔,但也有很多人...

不管怎樣,我通過拖動目錄

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

到框架文件夾中的Xcode和點擊修復此OK在導入對話框中。

1

是的,如果您的代碼調用框架,您必須將該框架添加到您的目標並與之鏈接。

確保框架是「相對於當前SDK」(選擇框架>獲取信息>常規選項卡),以便在爲設備構建時鏈接到設備的版本,而不是模擬器的鏈接。