Displaying a stock iOS notification banner when your app is open and in the foreground?

iOS 10 adds the UNUserNotificationCenterDelegate protocol for handling notifications while your app is in the foreground. The UNUserNotificationCenterDelegate protocol defines methods for receiving notifications and for handling actions. When your app is in the foreground, arriving notifications are delivered to your delegate object instead of displayed automatically using the system interfaces. Swift: optional func userNotificationCenter(_ … Read more

iOS push notification: how to detect if the user tapped on notification when the app is in background?

OK I finally figured out. In the target settings ➝ Capabilities tab ➝ Background Modes, if you check “Remote Notifications”, application:didReceiveRemoteNotification: will get triggered as soon as notification arrives (as long as the app is in the background), and in that case there is no way to tell whether the user will tap on the … Read more

Renew Push certificate and keep current App Store App working

The push certificate cannot be renewed. You have to create a new one. The push notification certificate is not part of the application build. Therefore for push to continue working you only have to create a new certificate and deploy the p12 file (or whatever other format you are using) at your server. You don’t … Read more

How to fix “no valid ‘aps-environment’ entitlement string found for application” in Xcode 4.3?

If you created your provisioning profile before configuring the app ID for push, try to regenerate the provisioning profile. iOS Provisioning Portal -> Provisioning -> Your cert -> EDIT -> Make an edit -> Download new provisioning Worked for me. Now i’m able to use push.

How can I convert my device token (NSData) into an NSString?

If anyone is looking for a way to do this in Swift: Swift 3 introduces the Data type, with value semantics. To convert the deviceToken to a String, you can do as follows: func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { let token = deviceToken.map { String(format: “%02.2hhx”, $0) }.joined() print(token) } Old answer using … Read more

Detect if the app was launched/opened from a push notification

See This code : – (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { if ( application.applicationState == UIApplicationStateInactive || application.applicationState == UIApplicationStateBackground ) { //opened from a push notification when the app was on background } } same as -(void)application:(UIApplication *)application didReceiveLocalNotification (UILocalNotification *)notification

Creating .pem file for APNS?

Here is what I did, From:blog.boxedice.com and “iPhone Advanced Projects” chapter 10 byJoe Pezzillo. With the aps_developer_identity.cer in the keychain: Launch Keychain Access from your local Mac and from the login keychain, filter by the Certificates category. You will see an expandable option called “Apple Development Push Services” Right click on “Apple Development Push Services” … Read more

registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later

For iOS<10 – (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; } For iOS10 https://stackoverflow.com/a/39383027/3560390

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)