2014-09-29 17 views
26

को अद्यतन करने के बाद से स्थानीय अधिसूचना काम नहीं कर रही है क्या आईओएस 8 और एक्सकोड 6 को अपडेट करने के बाद किसी और को स्थानीय नोटिफिकेशन में समस्या है? मेरे पास मेरा एप्लिकेशन है जो ठीक चल रहा था और notification.firdate दिनांक पिकर से सेट किया गया था और ठीक काम कर रहा था, notification.alertBody ठीक दिखाया गया। अब मैंने अपडेट किया है यह काम नहीं करता है। मैंने ब्रेक पॉइंट्स जोड़े हैं और मेरे फायरेट में एक मूल्य संग्रहीत है। क्या कोई मेरी मदद कर सकता हैं?आईओएस 8 और एक्सकोड 6

+0

सुनिश्चित करें कि आप स्थानीय सूचनाओं के लिए पंजीकृत कर रहे हैं (यह अनिवार्य है), तो उचित प्रतिनिधि कॉलबैक लागू। आईओएस 8 में बदलावों की एक नाव लोड है ... अत्यधिक अनुशंसा करते हैं कि आप डब्ल्यूडब्ल्यूडीसी वीडियो देखें। – BonanzaDriver

उत्तर

68

आपको आईओएस 8 में अधिसूचनाएं प्राप्त करने में सक्षम होने के लिए अपना कोड अपडेट करना होगा। अधिक जानकारी here

ऑब्जेक्टिव-सी कोड:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){ 
    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]]; 
    } 
    // Override point for customization after application launch. 
    return YES; 
} 

स्विफ़्ट कोड:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 
//registering for sending user various kinds of notifications 
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound|UIUserNotificationType.Alert |UIUserNotificationType.Badge, categories: nil) 
// Override point for customization after application launch.  
return true 
} 
+0

आपकी प्रतिक्रिया के लिए धन्यवाद। मैंने तेजी से उपयोग नहीं किया है, क्या यह मेरे AppDelegate.m फ़ाइल में काम करेगा? – burrGGG

+12

@burrGGG एर, वह उद्देश्य सी कोड है। –

+1

यह काम करता है, आपके द्वारा भेजे गए लिंक को देख रहा था। आपकी मदद के लिए धन्यवाद – burrGGG

1

आदेश स्थानीय NSNotification प्राप्त करने के लिए नीचे दिए गए चरणों का पालन करें:

  1. अपने appDelegate.h में कोड जोड़ें didFinishLaunchingWithOptions विधि

    में 0
    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){ 
         [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]]; 
    } 
    
संबंधित मुद्दे