Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken in iOS10 beta? #1034

Closed
ccj242 opened this issue Jul 6, 2016 · 80 comments
Closed

Broken in iOS10 beta? #1034

ccj242 opened this issue Jul 6, 2016 · 80 comments

Comments

@ccj242
Copy link

ccj242 commented Jul 6, 2016

While the scheduling example for "5 seconds from now" works in the 9.3beta of iOS, it seems to break in the iOS10beta2. The success function fires, but no notification appears. Wonderful plugin, thank you a thousand times over!

@NorthMcCormick
Copy link

The code this plugin uses is 100% deprecated in iOS 10. Any app built for iOS 10, the notifications won't trigger. They need to use the new User Notifications API

@MohamedFekry007
Copy link

Dear, iam using windows phone 8 not ios
On Jul 11, 2016 1:54 AM, "North McCormick" notifications@github.com wrote:

The code this plugin uses is 100% deprecated in iOS 10. Any app built
for iOS 10, the notifications won't trigger. They need to use the new
User Notifications API


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1034 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ATcB_m6xVwCqIYVHT--mcnnOAkSx-J81ks5qUYY5gaJpZM4JGPvY
.

@NorthMcCormick
Copy link

@MohamedFekry007 That is not relevant to this specific issue

@MohamedFekry007
Copy link

Dear, ok sorry,

Could you check my issue please?
On Jul 11, 2016 1:57 AM, "North McCormick" notifications@github.com wrote:

@MohamedFekry007 https://github.com/MohamedFekry007 That is not
relevant to this specific issue


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1034 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ATcB_pHs7oV9KrvsfA1PpbAH4L9Nmpt2ks5qUYbZgaJpZM4JGPvY
.

@NorthMcCormick
Copy link

@MohamedFekry007 No, I only work with iOS, sorry.

@MohamedFekry007
Copy link

Ok thanks
On Jul 11, 2016 1:59 AM, "North McCormick" notifications@github.com wrote:

@MohamedFekry007 https://github.com/MohamedFekry007 No, I only work
with iOS, sorry.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1034 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ATcB_mzN3UMt-xgYGy8zdnogBC2D0chQks5qUYdlgaJpZM4JGPvY
.

@ccj242
Copy link
Author

ccj242 commented Jul 11, 2016

@NorthMcCormick Thank you so much for replying. What would you recommend as a solution for local notifications in iOS10 (for a cordova based app)? Are you available for hire / interested in coding a solution?

@MohamedFekry007
Copy link

Dear, of course why not
On Jul 11, 2016 4:57 AM, "Christopher CInq-Mars Jarvis" <
notifications@github.com> wrote:

@NorthMcCormick https://github.com/NorthMcCormick Thank you so much for
replying. What would you recommend as a solution for local notifications in
iOS10 (for a cordova based app)? Are you available for hire / interested in
coding a solution?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1034 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ATcB_uWTh6EKGPOtS-cNQt6EGIqgmbhyks5qUbE3gaJpZM4JGPvY
.

@jokiamo
Copy link
Contributor

jokiamo commented Jul 13, 2016

@joel-caton
Copy link

jokiamo what's the status on your fork? Is it working on ios 10 prerelease?

@jokiamo
Copy link
Contributor

jokiamo commented Jul 15, 2016

i tested on beta2 and work!

@NorthMcCormick
Copy link

@jokiamo Are you open to PRs for more features with the new notifications?

@jokiamo
Copy link
Contributor

jokiamo commented Jul 15, 2016

yes

@ccj242
Copy link
Author

ccj242 commented Jul 15, 2016

@jokiamo you are the best!! Can't wait to test your code. Incredibly grateful.

@joel-caton
Copy link

@jokiamo Well done my friend.

@ccj242
Copy link
Author

ccj242 commented Jul 19, 2016

@jokiamo Works brilliantly! Thank you so so so much!

@ccj242 ccj242 closed this as completed Jul 19, 2016
@ccj242
Copy link
Author

ccj242 commented Jul 20, 2016

Hey -- appears I jumped the gun slightly - while notifications appear, they don't seem to go off at the proper time. If I schedule a notification for an hour from now, the notification appears almost instantly, within a minute or so. Seems like great progress though!

@ccj242 ccj242 reopened this Jul 20, 2016
@malloc32
Copy link

malloc32 commented Jul 21, 2016

jokiamo solution does not work for me, for example it does not trigger events....
My solution is only change APPLocalNotificationOptions.m (original plugin), only replace NSCalendarUnitEra by 0, I do not know if this change can induce other problems, but at the moment it works ok.

(line 151)

  • (NSCalendarUnit) repeatInterval
    {
    NSString* interval = [dict objectForKey:@"every"];

    if ([self stringIsNullOrEmpty:interval]) {
    return 0;
    }
    else if ([interval isEqualToString:@"second"]) {
    return NSCalendarUnitSecond;
    }
    else if ([interval isEqualToString:@"minute"]) {
    return NSCalendarUnitMinute;
    }
    else if ([interval isEqualToString:@"hour"]) {
    return NSCalendarUnitHour;
    }
    else if ([interval isEqualToString:@"day"]) {
    return NSCalendarUnitDay;
    }
    else if ([interval isEqualToString:@"week"]) {
    return NSCalendarUnitWeekOfYear;
    }
    else if ([interval isEqualToString:@"month"]) {
    return NSCalendarUnitMonth;
    }
    else if ([interval isEqualToString:@"quarter"]) {
    return NSCalendarUnitQuarter;
    }
    else if ([interval isEqualToString:@"year"]) {
    return NSCalendarUnitYear;
    }

    return 0;
    }

I have changed the method too,

  • (BOOL) stringIsNullOrEmpty:(NSString*)str
    {
    if ([str length] == 0)
    return YES;

    return NO;
    }

@Tawpie
Copy link

Tawpie commented Aug 12, 2016

a couple of notes: the repo referenced above hardcodes a test notification to fire in 5 seconds, more work is needed to add full plugin functionality. There's an earlier and slightly more complete example of how to do this at https://github.com/ChenYilong/iOS10AdaptationTips

second: I found I needed to include the NotificationCenter.framework in my Xcode Linked Frameworks and Libraries else it wouldn't compile (duh)

also: the example repos use the @import directive, you must enable modules in your Xcode project (Build Settings, search for 'modules', then Enable Modules (C and Objective-C) on)

In my experiments (Xcode8b5 and ios10b5) trying to grab the plugin's fireDate and rejigger it for the new framework, I could get a notification to schedule without reporting an error but it didn't fire. Then without explanation my app wouldn't run anymore. I'm chalking that up to beta-ville, but it ran once and after that single run it can't get past the splash screen. Ugh.

@katzer I hope you're nearly finished with those other two plugins!

@malloc32
Copy link

Have you tested my solution? In my application it is working fine.

@Tawpie
Copy link

Tawpie commented Aug 12, 2016

I have not... mostly because by reading it I didn’t understand how you solved the deprecated API issue. It is however, possible that Apple won’t be making the old API go away immediately and that your fix solves another issue—so I’ll try it. If I can get the dang thing to work in Xcode8b5 on iOS10b5 that is. Q: what prompted you to approach the problem this way?

On Aug 12, 2016, at 4:34 PM, malloc32 notifications@github.com wrote:

Have you tested my solution? In my application it is working fine.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@Tawpie
Copy link

Tawpie commented Aug 16, 2016

@malloc32 I tried your solution today (file changes to -original- plugin, still uses the deprecated API), did not get notification to fire on iOS10b6 (iPhone5). Built in Xcode7.3(7D175), delivered to iPhone via TestFlight.

@malloc32
Copy link

Yes,it uses the deprecated api, I m only be able to do small changes,not iOS native programing...but it is working on an iPad,now I can not tell you the beta versión, but it works...

@ccj242
Copy link
Author

ccj242 commented Aug 18, 2016

@malloc32 I tried the code with the same specs as @Tawpie and was also unable to get it working. The GM has got to be dropping soon, - it would be ideal to have a solution before then so we can update our projects in time for the official release. If I knew objective-c I'd try to contribute myself -- hopefully someone or @katzer will find a solution soon. If there is anything productive I can do to help I'd very much like to.

@mkn20
Copy link

mkn20 commented Sep 8, 2016

Hey @jokiamo ! Tried your fork on iOS10 GM but it does not seem to work. It is an awesome plugin and it will great to have it working with iOS 10. Does anybody else has got it working as yet?

@mkn20
Copy link

mkn20 commented Sep 8, 2016

And, @malloc32 , tried your changes on iOS 10 GM. While notifications are scheduled and triggered, they are not shown.

@ccj242
Copy link
Author

ccj242 commented Sep 8, 2016

I can confirm @mkn20 - I tried as well.

@CookieCookson
Copy link

Works well for me here on Xcode 8 && iOS10, but I have only required it to fire a local notification straight away.

@Tawpie
Copy link

Tawpie commented Sep 13, 2016

thanks @spk0611, have tried that but it fails to build on Cordova. Details:
node: v5.9.1
npm: v3.8.9
Cordova: v6.3.1
Cordova iOS platform: v4.2.1 (and 3.9.1)
Xcode 8GM

Builds fine with the ‘stock’ Katzer plugin though.

Error message:
The following build commands failed:
CompileC build/SmartQuit.build/Debug-iphonesimulator/SmartQuit.build/Objects-normal/x86_64/APPLocalNotification.o SmartQuit/Plugins/de.appplant.cordova.plugin.local-notification/APPLocalNotification.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

So I’m stumped.

On Sep 13, 2016, at 7:06 AM, spk0611 notifications@github.com wrote:

plugin add https://github.com/spk0611/cordova-plugin-local-notifications.git https://github.com/spk0611/cordova-plugin-local-notifications.git

@CookieCookson
Copy link

@Tawpie I got it working with:

cordova plugin rm de.appplant.cordova.plugin.local-notification --save
cordova plugin add https://github.com/spk0611/cordova-plugin-local-notifications#9ad32cf2059cdf9a54b4930b1c58ba76ef7e3a87 --save

That adds the plugin at the specific commit referenced above where "iOS 10 - all events fired as other iOS versions" was added as noted by @ccj242

@spk0611
Copy link
Contributor

spk0611 commented Sep 13, 2016

@Tawpie can you please go to XCode -> Preferences -> Locations and check if Command Line Tools is set to XCode 8 for you? Or is it set to XCode 7?

@mkn20
Copy link

mkn20 commented Sep 13, 2016

Thank you @spk0611. On a quick test it seems to work in ios 10 GM. I'm scheduling multiple notifications at different dates and times and, for some reason, it fires only the first but somehow not the later ones. I'm using cordova ios 4.1.0. @acianti it is interesting. Does it work okay for you with @malloc32 's change on both iOS 9 and iOS 10?

@Tawpie
Copy link

Tawpie commented Sep 13, 2016

ah. 7.3. Resetting to 8, although I was able to get it to build using the sequence provided by @CookieCookson. next step: test! (yay, finally—will be testing with command line tools set to 8) Thank you all!

On Sep 13, 2016, at 8:41 AM, spk0611 notifications@github.com wrote:

@Tawpie https://github.com/Tawpie can you please go to XCode -> Preferences -> Locations and check if Command Line Tools is set to XCode 8 for you? Or is it set to XCode 7?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #1034 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AHVytGBpZCUO2yvgm67zasUg6SnDe5Xtks5qpsRHgaJpZM4JGPvY.

@mkn20
Copy link

mkn20 commented Sep 13, 2016

I think I'm seeing the trigger is not being fired in my case when my future date is in different timezone. For instance, if device is in PDT timezone, the scheduled notifications, as long as device timezone is still the same for the dates, seem to work fine. But when the timezone changes, say to PST, which has 1 hour difference from PDT, scheduled notification are not fired. Is there then a way to schedule a notification for PST, while the device is still in PDT, so that notification is fired in future at the correct time in future when the device timezone changes from PDT to PST? Hopefully it makes sense!

Any ideas in that regard?

@Tawpie
Copy link

Tawpie commented Sep 13, 2016

@spk0611 Been fighting with this all afternoon, but when I use your repo everything will (finally) build, but cordova.plugins.notification is undefined. Stock Katzer is fine though. Any clues for me? (Thanks)

@Tawpie
Copy link

Tawpie commented Sep 14, 2016

A couple of notes while I wait to see if the notification will fire...

  1. be certain to add the UserNotifications.framework to your target
  2. be certain to "Enable Modules (C and Objective-C)" in Build Settings (search for modules)

Otherwise cordova/Xcode will crash when you attempt to build.

I also left in the cordova-plugman engine definition in plugin.xml (it was commented out in one of Katzer's commits) as that "seems" to be the key to not losing cordova.plugins.notification. I didn't do the back and forth to be certain, but with that definition left in I regain access to the plugin.

AND. Victory! A date and time based notification just fired and tapping it launches my app. No sound oddly, but it's a start.

MANY, many thanks to all of you! (now we build for testflight and see what new surprises Apple has in store there eh?)

@katzer
Copy link
Owner

katzer commented Sep 14, 2016

Hi all, sorry I haven't yet had the time to look into it. Even the update for the background-mode plugin is paused as I don't know what to do first... It looks like to support iOS10 it will need more that just a hot fix. Damn Apple...

@ccj242
Copy link
Author

ccj242 commented Sep 15, 2016

Again, @spk0611's PR #1093 works for me on iOS10GM - with the caveat that @sparsh0611 mentioned. My issues have been resolved for the time being, thank you all! Shall I keep the issue open as a courtesy to others?

@dpogue
Copy link
Contributor

dpogue commented Sep 15, 2016

It's not safe to blindly schedule in the fireEvent function without checking what type of event was fired. That function is called for schedule, update, cancel, cancelall, clear, clearall, trigger, and click.

@mkn20
Copy link

mkn20 commented Sep 15, 2016

For me, I'm getting some inconsistent results when using the released iOS 10. I'm scheduling multiple notifications at different dates and times in future (by passing them as an array to the schedule method for the plugin) and, for some reason, it fires only some of them but not all. On the other hand, all are fired just fine when using iOS 9. Not sure what I'm missing.

@ccj242
Copy link
Author

ccj242 commented Sep 15, 2016

To echo @mkn20, I have noticed some inconsistent results as well compared to iOS9 - I can't identify any pattern to them - they seem random. Still, grateful to have something half working for iOS10 rather than not at all.

@NorthMcCormick
Copy link

@spk0611's PR seems to be working (#1093) for me too. For context:

I'm scheduling a notification ~1-5 minutes ahead at a time.

@spk0611
Copy link
Contributor

spk0611 commented Sep 18, 2016

@ccj242 Looking at the issues others (and you) are facing, I don't think this issue should be closed for now.
@mkn20 @dpogue Thanks for letting me know. I'll try to identify the issues and work on fixing them.
It's working so far in the scope that I require it for. But, I think it'll be better if it's more stable. So, if there's someone who can help in fixing the issues, it'll be really appreciated.

@FlossyWeb
Copy link

+1 Working but not as stable as it used to work prior to iOS 10.

@lucbonnin
Copy link

@katzer i understand it will take time to fix this damn ios10 update properly but is there anyway to commit a half patch commit on master branch ? (to satisfy a part of the plugin users and let them wait a few days more to the final fix) ?
Your plugin seems the only one to be working for local notification on android and ios and if we could avoid using temp branches, it should be great and better for all (at least for test and issues report purposes)

@NorthMcCormick
Copy link

NorthMcCormick commented Sep 23, 2016

@lucbonnin I agree, if you didn't see this and need it in the mean time (or anyone else who needs to use the plugin patch, here is how to do that): #1093 (comment)

@katzer
Copy link
Owner

katzer commented Sep 23, 2016

Hey all, I've merged the PR #1093 into the iOS10 branch!

@gorbatenkov
Copy link

Hello everyone, will iOS10 branch be merged to the master branch sometime?

@katzer
Copy link
Owner

katzer commented Oct 10, 2016

I am working on it already. I haven't yet done any commits but the new version will not be compatible anymore with iOS 9 because of the new UserNotifications API.

@katzer
Copy link
Owner

katzer commented Oct 18, 2016

I've updated the ios10 branch. It supports both iOS9+iOS10. Its still a work in progress but most things do work. It does not yet contain any new features provided by the new SDK.

@FlossyWeb
Copy link

Thank you @katzer it was not a breaking one for me, but I followed this bug and I really want to take a moment to give thanks for the work done.

@Quixotical
Copy link

@katzer thank you for making this plugin, I'm attempting to use the ios10 branch in my application, but I'm getting really inconsistent results when attempt to schedule multiple notifications. For example, when I schedule 8 notifications, 2 minutes apart (just so i can test that the delayed notifications work) I will get the first notification, but then none of the others. I was wondering if these issues were going to be resolved anytime soon, since it appears this has been an issue for the past 4-5 months already. I was hoping to use this plugin in my application because my needs for notifications aren't that large, but if scheduling notifications for the future just doesn't work at all, then I would need to use push notifications since this is the only local notifications plugin.

@katzer
Copy link
Owner

katzer commented Nov 1, 2017

Please use 0.9-beta - thanks

@katzer katzer closed this as completed Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests