Confused by Local Notifications Plugin Setup - Apple

Hi All;

I have a pair of apps that we are updating that have used the older “system” notification calls for a long time to do LOCAL notifications. I thought that the move to the plugin setup in January would be straightforward. These apps have Apple App IDs that have never had PUSH Notifications enabled — we are only using LOCAL notifications. So I moved the calls over to using the plugin as I was working on the updates.

Build Settings includes:

[lua]

[“plugin.notifications”] =

{

publisherId = “com.coronalabs”,

},

[/lua]

And I built the app using my Development Provisioning Profile (based on the App ID) using Corona Build #2583. When I put the app on my iPad for test, I bump into these problems.

#1 - Regarding registerForPushNotifications() — If I call the following . . . 

[lua]

local notifications = require(“plugin.notifications”)

notifications.registerForPushNotifications()

[/lua]

I get this error message in the console: 

<Warning>: AppDelegate.mm: didFailToRegisterForRemoteNotificationsWithError: no valid ‘aps-environment’ entitlement string found for application

And no Apple Alert appears asking me (the user) for notifications permission.

#2 - Regarding notifications.scheduleNotification(time, options) — If I call the following using exact commands and variables that have worked in the past . . . 

[lua]

local notifications = require(“plugin.notifications”)

notifications.scheduleNotification( time, options )

[/lua]

I get this error message in the console: 

<Warning>: Attempting to schedule a local notification <UIConcreteLocalNotification: 0x1bbe0720>{fire date = Friday, April 17, 2015 at 9:35:42 AM Eastern Daylight Time, time zone = (null), repeat interval = 0, repeat count = UILocalNotificationInfiniteRepeatCount, next fire date = Friday, April 17, 2015 at 9:35:42 AM Eastern Daylight Time, user info = { body = “Good luck with my\nnext several puzzles!\n\n--   David L. Hoyt   --”;id = levelattained; title = “Glad You are Playing”;}} with an alert but haven’t received permission from the user to display alerts

And I get the above error message whether or not I have attempted to registerForPushNotifications() before or after I have tried to schedule something.

Also, I have tried all of the above with and without the following section in my config.lua file:

[lua]

notification = 

    {

        iphone =

        {

            types = { “badge”, “sound”, “alert” }

        }

    }

[/lua]

The documentation at AppNotification Doc leads me to think that this entry is only necessary for PUSH (and not LOCAL). Putting in this config.lua table entry doesn’t alter either of the errors I get when the “registerForPushNotifications()” or “scheduleNotification” calls.

==============================================================================

In essence, I am confused by this problem. Do I now have to have Push Notifications (with 3rd party SSL Certificates, etc.) enabled for an App ID if ALL I WANT TO DO IS LOCAL NOTIFICATIONS? Or am I missing something important in the new plugin setup? Not certain if this is a bug of my failure to understand.

Thanks for any guidance.

Steve

Hi Steve,

As I understand it, the “registerForPushNotifications()” call is only for push notifications, and it entails that little popup alert that says something like “[AppName] would like to send you push notifications” with little “accept” or “deny” buttons. You shouldn’t need to make that call if you’re only using local notifications. However, if you’re getting some really weird error or hangup on this, let me know so I can investigate further.

Thanks,

Brent

Hi Brent;

Thanks. You might have missed the part of my post where I get Error #2 (scheduleNotification) and then said:

“And I get the above error message whether or not I have attempted to registerForPushNotifications() before or after I have tried to schedule something.”

That error message when I try to schedule a notification essentially says:

“<Warning> Attempting to schedule a local notification with an alert but haven’t received permission from the user to display alerts.”

And it errors this way ALWAYS (and when “registerFor . . .” has never ever been called or considered).

So I’m wondering if your build server is failing to do something now that it used to do when describing an app’s properties to the device. This is the reason I ask:

A) PAST PERFORMANCE: When I used to make test builds for iOS of my apps and my code included “system.scheduleNotification” calls (built using a Development Provisioning Profile), the installation of that test app on a device would immediately make the App’s icon appear appropriately on the device’s SETTINGS > NOTIFICATIONS screen and the App’s settings for “Badges,Sounds,Banners” would be settable in SETTINGS. And all three would be turned ON by default.

B)  PRESENT** PERFORMANCE: **But now, when I make the same test build and include the plugin listing in build.settings, the App’s icon does appear in SETTINGS > NOTIFICATIONS as expected. But the icon does not initially show “Badges,Sounds” turned on – as it has always done in the past. The only thing turned ON is “Banners”.

Hope this is the insight you need to recommend a solution.

Steve

What version of Corona SDK are you building with?

Rob

Hi Rob;

That info was up in my original post. I was (and presently am) using Daily Build #2583.

Thanks for any light you can shed.

Best;

Steve

Hi Steve,

As I understand it, the “registerForPushNotifications()” call is only for push notifications, and it entails that little popup alert that says something like “[AppName] would like to send you push notifications” with little “accept” or “deny” buttons. You shouldn’t need to make that call if you’re only using local notifications. However, if you’re getting some really weird error or hangup on this, let me know so I can investigate further.

Thanks,

Brent

Hi Brent;

Thanks. You might have missed the part of my post where I get Error #2 (scheduleNotification) and then said:

“And I get the above error message whether or not I have attempted to registerForPushNotifications() before or after I have tried to schedule something.”

That error message when I try to schedule a notification essentially says:

“<Warning> Attempting to schedule a local notification with an alert but haven’t received permission from the user to display alerts.”

And it errors this way ALWAYS (and when “registerFor . . .” has never ever been called or considered).

So I’m wondering if your build server is failing to do something now that it used to do when describing an app’s properties to the device. This is the reason I ask:

A) PAST PERFORMANCE: When I used to make test builds for iOS of my apps and my code included “system.scheduleNotification” calls (built using a Development Provisioning Profile), the installation of that test app on a device would immediately make the App’s icon appear appropriately on the device’s SETTINGS > NOTIFICATIONS screen and the App’s settings for “Badges,Sounds,Banners” would be settable in SETTINGS. And all three would be turned ON by default.

B)  PRESENT** PERFORMANCE: **But now, when I make the same test build and include the plugin listing in build.settings, the App’s icon does appear in SETTINGS > NOTIFICATIONS as expected. But the icon does not initially show “Badges,Sounds” turned on – as it has always done in the past. The only thing turned ON is “Banners”.

Hope this is the insight you need to recommend a solution.

Steve

What version of Corona SDK are you building with?

Rob

Hi Rob;

That info was up in my original post. I was (and presently am) using Daily Build #2583.

Thanks for any light you can shed.

Best;

Steve

Hi SBullock, did you ever resolve this issue?

I just upgraded to 2646 and I’m getting the error message also, however it seems that the badge does indeed appear, so looks like the warning is safe to ignore?

Hi SBullock, did you ever resolve this issue?

I just upgraded to 2646 and I’m getting the error message also, however it seems that the badge does indeed appear, so looks like the warning is safe to ignore?