मेरे ऐप में मैं अपने ऐप के सेटिंग पेज से पुश अधिसूचना को सक्षम/अक्षम करना चाहता हूं। क्या कोई मुझे ऐप से अधिसूचना केंद्र में ऐप की स्थिति चालू/बंद करने का समाधान सुझा सकता है?ऐप से पुश अधिसूचना को सक्षम/अक्षम कैसे करें?
उत्तर
आप पंजीकरण कोड के साथ रिमोट अधिसूचना पंजीकृत और पंजीकरण कर सकते हैं।
रजिस्टर bellow code..means साथ RemoteNotification अधिसूचना
//-- Set Notification
if ([[UIApplication sharedApplication]respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
// For iOS 8 and above
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
// For iOS < 8
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
सक्षम और bellow कोड के साथ अक्षम करें।
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
स्विफ्ट 4
पुश नोटिफिकेशन (app से सेटअप) सक्षम करें:
:if #available(iOS 10.0, *) {
// SETUP FOR NOTIFICATION FOR iOS >= 10.0
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
if error == nil{
DispatchQueue.main.async(execute: {
UIApplication.shared.registerForRemoteNotifications()
})
}
}
} else {
// SETUP FOR NOTIFICATION FOR iOS < 10.0
let settings = UIUserNotificationSettings(types: [.sound, .alert, .badge], categories: nil)
UIApplication.shared.registerUserNotificationSettings(settings)
// This is an asynchronous method to retrieve a Device Token
// Callbacks are in AppDelegate.swift
// Success = didRegisterForRemoteNotificationsWithDeviceToken
// Fail = didFailToRegisterForRemoteNotificationsWithError
UIApplication.shared.registerForRemoteNotifications()
}
प्रतिनिधि सूचनाएं
@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping() -> Void) {
}
@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// ...register device token with our Time Entry API server via REST
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
//print("DidFaildRegistration : Device token for push notifications: FAIL -- ")
//print(error.localizedDescription)
}
पुश Notifiacation अक्षम धक्का संभाल करने के तरीकों
UIApplication.shared.unregisterForRemoteNotifications()
स्विफ्ट 3 समान है? –
@ जॉनीडगुड मुझे स्विफ्ट 3 के बारे में निश्चित नहीं है क्योंकि मैंने स्विफ्ट 4 के समर्थन के साथ एक्सकोड 9 बीटा के साथ अपनी परियोजना में इसे कोड किया है और स्विफ्ट 4 के साथ काम कर रहा है। लेकिन हां, यह पुश अधिसूचना कोडिंग पैटर्न में बड़ा अंतर नहीं हो सकता है तेज़ 3 और 4. मैं इस कोड के साथ स्विफ्ट 3 में कोशिश करूंगा और यहां अपडेट करूँगा। – Krunal
- 1. पुश अधिसूचना
- 2. पुश अधिसूचना
- 3. पुश अधिसूचना बैज आईफोन
- 4. एक दूरस्थ पुश अधिसूचना
- 5. आईओएस में पुश अधिसूचना बैज गिनती को कैसे साफ़ करें?
- 6. ब्लैकबेरी पुश अधिसूचना कार्यान्वयन
- 7. पुश अधिसूचना डिवाइस टोकन?
- 8. आईफोन पुश अधिसूचना reliablity
- 9. एंड्रॉइड: अधिसूचना से ऐप को फिर से शुरू कैसे करें?
- 10. ऐप्पल पुश अधिसूचना प्रमाणपत्र समाप्ति
- 11. एंड्रॉइड पुश अधिसूचना
- 12. अपने एंड्रॉइड ऐप में पुश अधिसूचना कैसे जोड़ें
- 13. पुश अधिसूचना को संभालना जबकि ऐप खुला है
- 14. ऐप्पल पुश अधिसूचना
- 15. पुश अधिसूचना एंड्रॉइड
- 16. पुश अधिसूचना के सर्वर साइड को सेट करें
- 17. शहरी एयरशिप से पुश अधिसूचना एंड्रॉइड
- 18. "पुश अधिसूचना" - राय, स्थापना रद्द करें आवेदन
- 19. डब्ल्यूपीएफ/डब्ल्यूसीएफ पुश अधिसूचना
- 20. सेब पुश अधिसूचना सीमा
- 21. पुश-अधिसूचना बैज ऑटो वृद्धि
- 22. ऐप्पल पुश अधिसूचना बैज संख्या
- 23. ग्राहक साइट पर ऐप्पल पुश अधिसूचना प्रमाणपत्र कैसे तैनात करें
- 24. फोनगैप के साथ पुश अधिसूचना - कॉर्डोवा पुश प्लगइन और pushwoosh.com
- 25. आईओएस पुश सेवाएं: एक अदृश्य पुश अधिसूचना संभव है?
- 26. आईओएस पुश अधिसूचना - जब आप अधिसूचना इस सवाल का
- 27. आईफोन पुश अधिसूचना - डिफ़ॉल्ट ध्वनि का उपयोग कैसे करें
- 28. मोबाइल वेब में पुश अधिसूचना
- 29. एंड्रॉइड पुश अधिसूचना सेवा तुलना
- 30. कस्टम आईओएस पुश अधिसूचना ध्वनि
Thanx दोस्त पर एप्पल द्वारा एक दस्तावेज़ .. इसके Appdelegate.But में प्रतिनिधि में प्रवेश इसकी सूचना केंद्र – Jeff
में चेतावनी शैली के मूल्य में बदलाव नहीं: यह संभव है अधिसूचना केंद्र में अलर्ट शैली के मूल्य को बदलें। यह 'कोई नहीं' – Jeff
@Jeff के लिए इस उत्तर दोस्त को देखता है http://stackoverflow.com/questions/1535403/determine-on-iphone-if-user-has- सक्षम-पुश-नोटिफिकेशन हो सकता है कि आप इससे विचार प्राप्त कर सकें .. :) –