swift - 使用未解析的标识符'ns'

时间:2015-10-01 23:03:54

标签: swift

我无法解决此问题,我正在迁移版本1.2到2.0

(Node 2 [Node 3 [], Node 4 []])

1 个答案:

答案 0 :(得分:1)

我会将注册方法转移到if语句中:

if #available(iOS 8.0, *) {
  let ns = UIUserNotificationSettings(forTypes: [UIUserNotificationType.Sound, UIUserNotificationType.Alert, UIUserNotificationType.Badge], categories: nil)

  UIApplication.sharedApplication().registerUserNotificationSettings(ns);
} else {
  // Fallback for earlier iOS versions
};