0

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?

Gruntcakes
  • 37,738
  • 44
  • 184
  • 378

2 Answers2

1

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

Community
  • 1
  • 1
Fred
  • 421
  • 2
  • 6
0

To solve these linker errors when migrating to XCode 6 Beta 6 delete the contents of the Derived Folder as answered here: Swift beta 6 - Confusing linker error message

Community
  • 1
  • 1
fluxa
  • 1,031
  • 1
  • 10
  • 10