我沒有得到這個錯誤警告,直到我更新到最新版本的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;
}
這聽起來像是某種類型推斷在XCode 6中被破解了。演員們將解決這個問題。 – Petesh 2014-10-23 14:18:15