SORU
27 HAZİRAN 2014, Cuma


registerForRemoteNotificationTypes: iOS 8.0 ve üstü desteklenmiyor

Bas kayıt olmaya çalışırken bildirimleri altında 8 iOS.x:

application.registerForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound)

Aşağıdaki hatayı alıyorum:

registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.

Bunu yapmak için yeni bir yol ne herhangi bir fikir? İOS 7 Bu Hızlı uygulamayı çalıştırdığımda çalışıyor.x.

EDİT

İOS 7 üzerinde.x alırım koşullu kod eklediğim zaman __İPHONE_OS_VERSİON_MAX_ ^ İZİN verilirse. (ya SystemVersion koşullu ya # = 80000)

dyld: Symbol not found: _OBJC_CLASS_$_UIUserNotificationSettings

CEVAP
16 Temmuz 2014, ÇARŞAMBA


Böyle büyük mükafat 6 (bu sürümü sadece çalışır) basit

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    //-- Set Notification
    if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) 
    {
           // iOS 8 Notifications
           [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

           [application registerForRemoteNotifications];
    }
    else
    {
          // iOS < 8 Notifications
          [application registerForRemoteNotificationTypes:
                     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
    }

     //--- your custom code
     return YES;
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • ASUS Campus Life

    ASUS Campus

    18 Mart 2013
  • Awesomesauce Network

    Awesomesauce

    4 EKİM 2012
  • JTechTalk

    JTechTalk

    11 Temmuz 2010