2011-05-23 37 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對象。