2013-03-11 141 views
1

我試過這段代碼:沒有@interface看得到的「UIIApplication」宣佈選擇「allocsharedApplication」

NSCalendar * calendar = [NSCalendar autoupdatingCurrentCalendar]; 
NSDateComponents * dateComponents = [[NSDateComponents alloc] init]; 
[dateComponents setDay:11]; 
[dateComponents setMonth:3]; 
[dateComponents setYear:2013]; 
[dateComponents setHour:6]; 
[dateComponents setMinute:00]; 
NSDate * date = [calendar dateFromComponents:dateComponents]; 
UILocalNotification * localNotification = [[UILocalNotification alloc] init]; 
[localNotification setFireDate:date]; 
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]]; 
[localNotification setAlertBody:@"E' il primo di ottobre"]; 
[localNotification setAlertAction:@"Apri applicazione"]; 
[localNotification setSoundName:UILocalNotificationDefaultSoundName]; 
[localNotification setApplicationIconBadgeNumber:17]; 
NSArray * oggetti = [NSArray arrayWithObjects:@"Mangiare", @"Bere", nil]; 
NSArray * chiavi = [NSArray arrayWithObjects:@"azione1", @"azione2", nil]; 
NSDictionary * dictionary = [[NSDictionary alloc] initWithObjects:oggetti forKeys: chiavi]; 
[localNotification setUserInfo:dictionary]; 
[[application allocsharedApplication] scheduledLocalNotifications:localNotification]; 

行和最後一行給了我這個錯誤:「否‘UIIApplication’分享@interface聲明的選擇「 allocsharedApplication'」。 !?!?!?

回答

2

最後一行是錯誤的。 正確的是:

[application scheduleLocalNotifications:localNotification]; 
相關問題