2
A
回答
0
我不知道如何編寫代碼,但如果您要將這樣的應用程序提交到應用程序商店,蘋果將不會批准它。蘋果嚴格的審查指南可能令人沮喪,就像在這種情況下,它們限制了你的應用程序的功能。對不起:(
+0
這是我的應用程序的一小部分,不用擔心,已準備好所有類似的應用程序批准。 – hafedh
0
你明明是因爲你想指定的應用程序證件號碼不能重複使用本地通知,因此你必須使用一個本地通知的每一天安排在午夜,並與相應的證件號碼。
因爲你只能安排最多64個本地通知,你必須在每一個應用程序啓動排隊的通知。
這段代碼沒有進行測試,則可能是夏令時間等問題(可在iOS 4.2或更高版本,使用ARC)
- (void) applicationDidBecomeActive:(UIApplication *)application {
NSUInteger startingDayAfterToday = [application.scheduledLocalNotifications count];
NSArray *localNotifications = [self localNotificationsStartingOnDayAfterToday:startingDayAfterToday];
NSArray *newScheduledNotifications = [application.scheduledLocalNotifications arrayByAddingObjectsFromArray:localNotifications];
[application setScheduledLocalNotifications:newScheduledNotifications];
}
- (NSArray *) localNotificationsStartingOnDayAfterToday:(NSUInteger)startingDayAfterToday {
NSMutableArray *localNotifications = [[NSMutableArray alloc] initWithCapacity:64 - startingDayAfterToday];
for (NSUInteger i = startingDayAfterToday; i < 64; i++) {
// Create a new local notification
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.hasAction = NO;
// Create today's midnight date
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; // Could be other calendar, too
NSDateComponents *todayDateComponents = [calendar components:(NSEraCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:[NSDate date]];
NSDate *todayMidnight = [calendar dateFromComponents:todayDateComponents];
// Create the fire date
NSDateComponents *addedDaysComponents = [[NSDateComponents alloc] init];
addedDaysComponents.day = i;
NSDate *fireDate = [calendar dateByAddingComponents:addedDaysComponents toDate:todayMidnight options:0];
// Set the fire date and time zone
notification.fireDate = fireDate;
notification.timeZone = [NSTimeZone systemTimeZone];
// Set the badge number
NSDateComponents *fireDateComponents = [calendar components:NSDayCalendarUnit fromDate:fireDate];
notification.applicationIconBadgeNumber = fireDateComponents.day;
// We're done, add the notification to the array
[localNotifications addObject:notification];
}
return [localNotifications copy];
}
相關問題
- 1. 每天更新一次申請徽章
- 2. 更新徽章圖標
- 3. 更新iOS圖標徽章號碼
- 4. 如何將徽章更靠近圖標?
- 5. 如何更新的TabBar圖片徽章
- 6. WinRT活動圖塊徽章更新
- 7. 在iOS7的背景中更新徽章圖標
- 8. 徽章,更新料號?
- 9. 圖標徽章通知
- 10. 應用程序圖標徽章數量不增加:Xcode中
- 11. Mahapps metro徽章控制如何更新徽章的價值
- 12. 應用關閉時更新徽章圖標
- 13. 從NSOperation線程更新UITabBar徽章圖標
- 14. 的Xcode夫特3.0通知框架應用徽章不更新
- 15. Silverlight/xaml中的通知圖標徽章
- 16. 更新圖標的徽章,並在單擊圖標時獲取通知消息
- 17. 是否可以自定義應用程序圖標徽章:Xcode?
- 18. 每天更換圖標
- 19. 如何在Android中更新標籤上的徽章值?
- 20. 我如何每週更新應用程序徽章?
- 21. 將徽章刷新到Finder中的文件圖標
- 22. 如何使用pushWoosh更新iOS徽章?
- 23. iOS:徽章拒絕更新(編輯器)
- 24. 徽章appStore通知不會更新
- 25. iOS徽章號碼實時更新
- 26. 更新推送通知徽章數
- 27. UITableViewCell中的徽章視圖
- 28. 每天用新文本更新標籤
- 29. TideSDK - 顯示未讀數(圖標徽章)
- 30. Swift圖標徽章編號感嘆號
有什麼想法嗎? – hafedh