2011-11-01 15 views
5

पर काम नहीं करता है अधिसूचना केंद्र में सब कुछ कॉन्फ़िगर करने के बाद, जो ऐप को अधिसूचना प्रदर्शित करने की अनुमति देता है, मेरे ऐप की स्थानीय अधिसूचना आग नहीं होती है।स्थानीय अधिसूचना आईओएस 5

क्या आपको एक ही समस्या का सामना करना पड़ता है?

अधिक जानकारी:

  1. एक ही ऐप्लिकेशन एक ही स्रोत कोड से संकलित कुछ दिन पहले, जो XCode 4.1 और iOS 4.3 SDK के साथ संकलित, सब कुछ अच्छी तरह से काम करता है।

  2. इसके अलावा, पुराने संस्करण एक्सकोड और आईओएस एसडीके के साथ संकलित ऐप अपग्रेड के बाद आईओएस 5 पर काम कर सकता है।

हालांकि, एक ही कोड के साथ संकलित ऐप, लेकिन एक्सकोड 4.2 और आईओएस 5 एसडीके काम नहीं करता है।

क्या आपके पास कोई विचार है? या आईओएस 5 के लिए कोई विशेष काम है?

नमूना कोड की तरह है:

UIApplication *app = [UIApplication sharedApplication]; 
NSArray *oldNotifications = [app scheduledLocalNotifications]; 

// Clear out the old notification before scheduling a new one. 
if (0 < [oldNotifications count]) { 

    [app cancelAllLocalNotifications]; 
} 

// Create a new notification 
UILocalNotification *alarm = [[UILocalNotification alloc] init]; 
if (alarm) { 

    alarm.fireDate = theDate; 
    alarm.timeZone = [NSTimeZone defaultTimeZone]; 
    alarm.repeatInterval = NSDayCalendarUnit; //repeat every day 
    alarm.alertBody = [NSString stringWithFormat:@"alert"];  
    [app scheduleLocalNotification:alarm]; 
    [alarm release]; 
} 

धन्यवाद, माइकल

उत्तर

11

iOS 5 में, सूचनाएं सूचना केंद्र द्वारा प्रबंधित कर रहे हैं। आपको अधिसूचना केंद्र (प्रोग्रामेटिक रूप से) के साथ अपना आवेदन पंजीकृत करना होगा, या (गैर-प्रोग्रामेटिक रूप से) Settings > Notifications पर जाएं और उपयुक्त सेटिंग्स का चयन करें यानी अधिसूचना केंद्र सक्षम करें, चेतावनी शैली का चयन करें, और अन्य।

आप, सूचना केंद्र (प्रोग्राम के रूप में) के साथ अपने आवेदन रजिस्टर करने के लिए applicationDidFinishLaunching: में इसके सामने कोड का टुकड़ा निम्न का उपयोग कर सकते हैं:

// Although Register For Remote Notifications is not required for Local Notifications, 
// but in iOS 5's Notifications, we have to register otherwise the system doesn't register/recognize 
// the notifications posted from the application. Note that this behavior is not documented 
// as of Oct 2011, and it's possible that it's a bug and will be handled in the future releases. 

[[UIApplication sharedApplication] registerForRemoteNotificationTypes: 
UIRemoteNotificationTypeAlert | 
UIRemoteNotificationTypeSound]; 

HTH।

+0

क्या हमें एपीएन सेवा सक्षम करने के लिए ऐप आईडी और एसएसएल प्रमाणपत्र भी कॉन्फ़िगर करना होगा? – user370773

+0

उत्तर के लिए धन्यवाद .. साथ ही UILocalNotificationDefaultSoundName को आईओएस 5.0 में कुछ समस्या है। –

संबंधित मुद्दे