简体   繁体   中英

Undefined symbols for architecture arm64 using MPMoviePlayerPlaybackDidFinishNotification with Xcode Beta 6

Since moving to Xcode 6 Beta 6 attempting to use MPMoviePlayerPlaybackDidFinishNotification in Swift code results in a linker error:

Undefined symbols for architecture arm64:
  "__TFSs26_forceBridgeFromObjectiveCU__FTPSs9AnyObject_MQ__Q_", 

Here's a relevant code snippet.

import MediaPlayer

class ViewControllerController : NSObject, MFMessageComposeViewControllerDelegate, MFMailComposeViewControllerDelegate {

    func thisWontLink () -> Void {
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "nothing:", name: MPMoviePlayerPlaybackDidFinishNotification, object: nil);
    }
    func nothing() -> Void {
    }

Replacing MPMoviePlayerPlaybackDidFinishNotification with "Some Random string" will result in the linker error going away. The app is linking with MediaPlayer.framework.

This only seems to be an issue using MPMoviePlayerPlaybackDidFinishNotification in combination with addObserver, for example assigning it to a varaible or printlning it doesn't result in the linker error.

Anything wrong with the code or is it an issue with XCode/swift?

Had the same strange errors after upgrading to xcode 6 beta 6. For me the problem got fixed with a Product -> Clean . And if that does not fix the errors hold down option and click on Product in the Menubar then you will see in the dropdown menu Clean Build Folder click on that.

Or you could download Watchdog app from appstore. This little helper automatically cleans your xcode projects. As mentioned here Xcode 6 Beta / Swift - Playground not updating

要在迁移到XCode 6 Beta 6时解决这些链接器错误,请按照以下说明删除Derived Folder的内容: Swift beta 6-令人困惑的链接器错误消息

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM