ios - UIRemoteNotificationType not working properly in Swift 2 -


this code given me in swift:

 if application.respondstoselector("registerusernotificationsettings:") {         let usernotificationtypes = uiusernotificationtype.alert | uiusernotificationtype.badge | uiusernotificationtype.sound         let settings = uiusernotificationsettings(fortypes: usernotificationtypes, categories: nil)         application.registerusernotificationsettings(settings)         application.registerforremotenotifications()     } else {         let types = uiremotenotificationtype.badge | uiremotenotificationtype.alert | uiremotenotificationtype.sound         application.registerforremotenotificationtypes(types)     } 

i receive error @ line 2 telling me:

| not prefix unary operator

what mean?

i receive error @ line 7 telling:

binary operator | cannot applied uiremotenotificationtype

can me better understanding on this? i'm clueless on what's going on.

in ios 9, apple doesn't give option use | , need group [.bagde ,.alert, .sound] sort of array

just change line

 let types = uiremotenotificationtype.badge | uiremotenotificationtype.alert | uiremotenotificationtype.sound   let usernotificationtypes = uiusernotificationtype.alert | uiusernotificationtype.badge | uiusernotificationtype.sound 

to

  let types = [.badge,.alert ,.sound]   let usernotificationtypes =  [.alert ,.badge ,.sound] 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -