2014-10-06 2 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

답변

1

할 수 있습니다 기본 중심이 방법을 주조하여 침묵 경고 :

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

오류가 제거되었습니다. 감사합니다. – user3344173

0

마지막 버전은 6.1입니다.
최신 버전으로 업데이트하십시오.

+1

업그레이드 했습니까? 오류 메시지가 계속 발생합니다. – user3344173

관련 문제