2014-10-06 212 views
2

我没有得到这个错误警告,直到我更新到最新版本的Xcode?Xcode 6.0.1新警告

Incompatible pointer types initializing 'MPNowPlayingInfoCenter' with an expression of type 'NSNotificationCenter’ 

CODE:

- (void)doUpdateNowPlayingCenter 
{ 
    if (!self.updateNowPlayingCenter || !self.nowPlayingItem) 
    { 
     return; 
    } 

    Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter"); 

    if (!playingInfoCenter) 
    { 
     return; 
    } 

    MPNowPlayingInfoCenter *center = [playingInfoCenter defaultCenter]; 
    NSDictionary *songInfo = @ 
    { 
     MPMediaItemPropertyTitle: [self.nowPlayingItem valueForProperty:MPMediaItemPropertyTitle], 
     MPMediaItemPropertyPlaybackDuration: [self.nowPlayingItem valueForProperty:MPMediaItemPropertyPlaybackDuration] 
    }; 

    center.nowPlayingInfo = songInfo; 
} 
+0

这听起来像是某种类型推断在XCode 6中被破解了。演员们将解决这个问题。 – Petesh 2014-10-23 14:18:15

回答

1

你可以沉默铸造默认中心这样的警告:

MPNowPlayingInfoCenter *center = (MPNowPlayingInfoCenter*)[playingInfoCenter defaultCenter]; 
+0

删除了错误,谢谢! – user3344173 2014-10-24 07:34:32

0

的最后一个版本是6.1。
更新到最新版本。

+1

是否升级,错误信息仍然存在 – user3344173 2014-10-24 07:34:00