2011-05-23 69 views
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; 
} 
+0

尝试将* badgeText设置为零而不是NULL。 – Jake 2011-05-23 22:52:08

+1

AppButton是如何声明的? – Rayfleck 2011-05-23 22:53:33

+0

支持@ MiRAGe的评论,请参阅[本文](http://stackoverflow.com/questions/5908936/iphonedifference-between-nil-nil-and-null) – Rayfleck 2011-05-23 22:55:39

回答

1

你显然还没有宣布AppButton。也许它叫做appButton?大写字母A表示它是一个类。你想要的是一个UIView对象。