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