ios - Xcode 6.0.1 新警告
<p><p>在更新到最新版本的 Xcode 之前,我没有收到此错误警告?</p>
<pre><code>Incompatible pointer types initializing 'MPNowPlayingInfoCenter' with an expression of type 'NSNotificationCenter’
</code></pre>
<p>代码:</p>
<pre><code>- (void)doUpdateNowPlayingCenter
{
if (!self.updateNowPlayingCenter || !self.nowPlayingItem)
{
return;
}
Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if (!playingInfoCenter)
{
return;
}
MPNowPlayingInfoCenter *center = ;
NSDictionary *songInfo = @
{
MPMediaItemPropertyTitle: ,
MPMediaItemPropertyPlaybackDuration:
};
center.nowPlayingInfo = songInfo;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以通过这种方式转换默认中心来消除警告:</p>
<pre><code>MPNowPlayingInfoCenter *center = (MPNowPlayingInfoCenter*);
</code></pre></p>
<p style="font-size: 20px;">关于ios - Xcode 6.0.1 新警告,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/26220537/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/26220537/
</a>
</p>
页:
[1]