1
這似乎是一個反覆出現的主題...我只有一個錯誤,它是一個未聲明的標識符... addBadgeToView:AppButton
在app_delegate中AppButton
是罪魁禍首。有什麼想法嗎?提前致謝!Undeclared標識符 - Xcode 4
app_header:
-(void) addBadgeToView:(UIView *)badgeView badgeText:(NSString *)badgeText badgeLocation:(CGPoint)badgeLocation shouldFlashBadge:(BOOL)shouldFlashBadge;
app_delegate:
-(void) AppNeedsToUpdateBadge:(int)badgeNum hasNumberChanged:(BOOL)hasNumberChanged
{
NSString *badgeText = NULL;
if(badgeNum > 0)
{
badgeText = [NSString stringWithFormat:@"%d", badgeNum];
}
[[AppManager sharedManager] addBadgeToView:AppButton badgeText:badgeText badgeLocation:CGPointMake(0,0) shouldFlashBadge:hasNumberChanged];
[UIApplication sharedApplication].applicationIconBadgeNumber = badgeNum;
}
嘗試將* badgeText設置爲零而不是NULL。 – Jake 2011-05-23 22:52:08
AppButton是如何聲明的? – Rayfleck 2011-05-23 22:53:33
支持@ MiRAGe的評論,請參閱[本文](http://stackoverflow.com/questions/5908936/iphonedifference-between-nil-nil-and-null) – Rayfleck 2011-05-23 22:55:39