有沒有辦法讓iOS的本地推送通知在OSX上工作?我有一個程序,即使程序關閉,我也希望從本地計算機收到預定的通知。我可以在OSX上使用iOS的本地推送通知嗎
2
A
回答
-1
0
這是本地通知
- (void)scheduleNotificationWithItem:(ToDoItem *)item interval:(int)minutesBefore {
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];
NSDateComponents *dateComps = [[NSDateComponents alloc] init];
[dateComps setDay:item.day];
[dateComps setMonth:item.month];
[dateComps setYear:item.year];
[dateComps setHour:item.hour];
[dateComps setMinute:item.minute];
NSDate *itemDate = [calendar dateFromComponents:dateComps];
[dateComps release];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
localNotif.fireDate = [itemDate addTimeInterval:-(minutesBefore*60)];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody [email protected]"Local Notification";
localNotif.alertAction = NSLocalizedString(@"View Details", nil);
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:item.eventName forKey:ToDoItemKey];
localNotif.userInfo = infoDict;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
}
相關問題
- 1. IOS本地推送通知
- 2. iOS + XMPP - 我可以在iOS中實現推送通知XMPPFramework嗎?
- 3. iOS推送通知可以選擇性地替換之前的通知嗎?
- 4. 結合本地的推送通知IOS
- 5. iOS的「本地」推送通知
- 6. 我可以使用什麼服務來發送IOS上的推送通知
- 7. iOS推送通知本地化
- 8. GCM可以向VoIP iOS發送推送通知消息嗎?
- 9. 我可以使用apn_on_rails推送報亭通知嗎?
- 10. 我們可以使用phonegap來推送通知嗎?
- 11. 用戶可以在本地禁用推送通知的聲音嗎?
- 12. 可本地化的推送通知
- 13. 我們可以使用Twilio iOS SDK進行VOIP推送通知嗎?
- 14. 我應該使用推送還是可以使用本地通知?
- 15. 如何在iOS 3.0中使用本地推送通知?
- 16. 我可以發送沒有聲音的本地通知嗎?
- 17. 我可以要求用戶啓用推送通知嗎?
- 18. 本地推送通知wp7
- 19. 是否可以在IOS上再次請求推送通知?
- 20. 我們可以用純文本(無JSON)發送推送通知負載嗎?
- 21. 發送推送IOS上的FCM通知
- 22. 黑莓推送通知(本地通知)
- 23. iOS Web Apps可以接收Apple推送通知嗎?
- 24. 我可以從後臺取消iOS本地通知嗎?
- 25. 使用react-native創建本地推送通知 - IOS
- 26. 我們可以在模擬器中檢查推送通知嗎?
- 27. 推送通知IOS
- 28. 推送通知IOS
- 29. iOS推送通知 -
- 30. iOs推送通知
我認爲你知道剛纔看你如何措辭這個問題的答案......話雖這麼說,搜索「用戶通知+山獅「,你應該找到更多的信息 – 2012-07-15 09:04:33