2013-03-12 2 views
-1

내 모델에는 일치하는 카드가 있거나 컨트롤러가 일치하지 않을 경우 컨트롤러 업데이트를 담당하는 알림 속성이 있습니다.NSString에 stringWithFormat을 보내려고 할 때 경고 받기

self.notification = [NSString stringWithFormat:@"%@ matched to %@", card.contents, otherCard.contents]; 

통지 읽기 전용 속성입니다 : 그래서,이 카드의 일치를 얻을 후 (모델에) 일치를 확인하는 방법에 내가이 줄을 썼다.

@property (readonly, nonatomic) NSString *notification; 

Ans By의 컨트롤러에 i'v이 라인을 썼다 :

이제 self.notificationLabel.text = [NSString stringWithFormat:self.game.notification];

, 그것은 완벽하게 작동을하지만 난 경고를 얻을 :

format string is not a string literal (potentially insecure), why is that?

+0

사실이 복제본은 _a 많이 있습니다. http://stackoverflow.com/search?q=format+string+is+not+literal+%5Bobjective-c%5D –

답변

0

가 알았어요을 , 나는 stringWithFormat을 사용할 필요가 없으며, 통지가 NSString 객체이므로 (컨트롤러에서) stringWithString 만 사용할 수 있습니다.

+2

'stringWithString :'어느 쪽이든. 당신은 다음과 같이하면된다 :'self.notificationLabel.text = self.game.notification;'. – rmaddy

+0

오, 고맙습니다. :) @rmaddy – JohnBigs

관련 문제