简体   繁体   English

使用带有Xcode Beta 6的MPMoviePlayerPlaybackDidFinishNotification的体系结构arm64的未定义符号

[英]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: 由于移至Xcode 6 Beta 6,尝试在Swift代码中使用MPMoviePlayerPlaybackDidFinishNotification会导致链接器错误:

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. 用“某些随机字符串”替换MPMoviePlayerPlaybackDidFinishNotification将导致链接器错误消失。 The app is linking with MediaPlayer.framework. 该应用程序与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. 将MPMoviePlayerPlaybackDidFinishNotification与addObserver结合使用似乎只是一个问题,例如,将其分配给变量或printlning不会导致链接器错误。

Anything wrong with the code or is it an issue with XCode/swift? 代码有什么问题吗?还是XCode / swift有问题?

Had the same strange errors after upgrading to xcode 6 beta 6. For me the problem got fixed with a Product -> Clean . 升级到xcode 6 beta 6后,发生了同样的奇怪错误。对我来说,此问题已通过Product- 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. 如果不修复错误按住选项并单击Product在菜单栏,那么你将在下拉菜单中看到Clean Build Folder上点击。

Or you could download Watchdog app from appstore. 或者您可以从appstore下载Watchdog应用程序。 This little helper automatically cleans your xcode projects. 这个小帮手会自动清理您的xcode项目。 As mentioned here Xcode 6 Beta / Swift - Playground not updating 如此处所述, Xcode 6 Beta / Swift-游乐场未更新

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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