0

Using the following code, have created the provisioning profile, but when I am trying run a development test I get llbd and app crashed.

 func application(application: UIApplication, 
 didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) 
 -> Bool {


// Override point for customization after application launch.



var type = UIUserNotificationType.Badge | UIUserNotificationType.Alert 
| UIUserNotificationType.Sound

var setting = UIUserNotificationSettings(forTypes: type, categories: 
nil)
UIApplication.sharedApplication().registerUserNotificationSettings(setting)

UIApplication.sharedApplication().registerForRemoteNotifications()



return true

 }



func application(application: UIApplication,    
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {

println(deviceToken)

}



func application(application: UIApplication,   
didFailToRegisterForRemoteNotificationsWithError error: NSError) {

println(error)

 }

Was able to get the Push popup to appear per LastMove's insight. But I am having an error connecting to the Push network. At first test I receive

 Trying 17.172.232.45...
  Connected to gateway.sandbox.push-apple.com.akadns.net

But then when trying to run the php I get

 Failed to connect: 111 Connection refused 

And also in terminal test I am seeing:

 openssl s_client -connect gateway.sandbox.push.apple.com:2195 
 CONNECTED(00000003)
 depth=1 /C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated 
 by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification   
 Authority - L1C
 verify error:num=20:unable to get local issuer certificate
 verify return:0
  6236:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake   
 failure:/SourceCache/OpenSSL098
 /OpeJamesJaJamJJJJJJJJJJJJJJaJamJamesJamesJameJamJaJJJJaJaJamess-MacBoJamJa

1 Answers1

1

I think your problem is about iOS 7/8. The api that you are using for push notification is the new one. It s not iOS 7 compatible. If you need to target iOS 7 use the old fashion. or better: https://stackoverflow.com/a/28742391/2327367

// Register for Push Notitications, if running iOS 8
if application.respondsToSelector("registerUserNotificationSettings:") {

  let types:UIUserNotificationType = (.Alert | .Badge | .Sound)
  let settings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: types, categories: nil)

  application.registerUserNotificationSettings(settings)
  application.registerForRemoteNotifications()

} else {      
  // Register for Push Notifications before iOS 8
  application.registerForRemoteNotificationTypes(.Alert | .Badge | .Sound)
}
Community
  • 1
  • 1
LastMove
  • 2,482
  • 1
  • 15
  • 25