swift, write code for ios 7 and 8

后端 未结 5 770
悲&欢浪女
悲&欢浪女 2020-12-30 03:23

i got an test app I\'m writing with Swift, I want to target iOS 7. But enable local notification I need to add

application.registerUserNotificationSettings(         


        
5条回答
  •  暖寄归人
    2020-12-30 03:42

    Unfortunately, I think you are running into a current limitation, see this

    What is the Swift preprocessor equivalent to iOS version check comparison?

    The only way to get around this is to add an Objective-C file, and then use #if macros and make two helper functions that you call from Swift (one for iOS8 and one for iOS7). I expect this will be fixed at some point.

提交回复
热议问题