I am trying to get actionable notifications working and I have gotten the actions to display when the notification is expanded, but I cannot get the delegate function to be called when I select an action. I am declaring self.notificationCenter.delegate = self in application(_:didFinishLaunchingWithOptions:), and, if I'm understanding correctly, when an action is selected it should call userNotificationCenter(_:didReceive:withCompletionHandler:), passing in the UNNotificationResponse object. But that method never gets triggered in my code. Any ideas why that may be happening?
The method you have mentioned above gets called as soon as you receive notification.
The method which is executed after clicking on action on notification is,
application:handleActionWithIdentifier:forRemoteNotification:completionHandler:
I figured out the issue. To handle notifications with content you have to add a service extension as a new target in the project. The last thing I ran was the service extension so the debugger wasn't stopping at breakpoints in the main app. I didn't know service extensions are essentially treated like completely separate apps. Since I was still in the process of working on the content of that method, what was in there was not working and it was hitting the breakpoints, so I thought it was not calling that function like it should.
Related
I have implemented INPauseWorkoutIntent, INStartWorkoutIntent or INResumeWorkoutIntent in my app in IOS 12 and XCode 10. I can use the commands correctly with using home button to open Siri but what I need is Hand off. I mean, I just want to say "Pause workout" and it should pause. I also don't want to use watch. How to achieve that, what am I missing?
Note: - (id)handlerForIntent:(INIntent *)intent not called anyways.
I believe you already have implemented resolve, confirm, and handler functions comforting to respective protocols.
I just check response code for workout and they have .continueInApp response code.
That being said, I believe you can pass response with code .continueInApp and save whatever parameters you have to use in UserActivity in handler's completion. UserAcitivity will be passed to application: continueUserActivity function in AppDelegate; so you can pause it from there.
If handlerForIntent is not called, then I believe intent is not understood by Siri
I followed the hello world example on this page to set up lua-lgi and libnotify, successfully getting a notification that looks and acts the samea s if using os.execute("notify-send..."). Notify-send does not allow user actions, from what I've gathered, so I am attempting to directly use the libnotify library to display a notification with a button. When clicked in the notification, it should open a file. I am able to call the function described here with lua, using (building from the hello world example):
Hello:add_action("button", "Open", function(notification, action, user_data) os.open("gedit tmp") end)
which successfully displays a button with the label "Open" in the notification. However, the callback function is not called, so the file does not open. I also noticed when running the script, it actually finishes executing before the notification has fully appeared, so if the program is not running anymore when the button in the notification is clicked, then that's one reason why the callback isn't being called, if it's working correctly up until that point. This is my first experience with lua-lgi, so I'm not sure how these types of callback functions translate into lua, or if they're even supported, which is probably what I'm really trying to understand here. Any help is appreciated regarding this issue, or insight into an alternative to displaying a notification with a button and callback via other means.
don't know if it's possible, but I have an app that prompts for a number to call. Then the "phone app" is called and the call goes on as usual
After the call ends I would like to trigger an event that makes the user "rate" the call made, always inside this app. I don't need to store any info from the call just done, since the call was already triggered from my app, so I already have the number
Is there a way to trigger those kind of events in iOS?
You need to use CTCallCenter and add a callEventHandler to be notified about state changes to the call.
During the initial app installation everything works as exptected: application:didRegisterForRemoteNotificationsWithDeviceToken: is called after the prompt *"APP Would Like To Send You Push Notifications"* is accepted or rejected. But if the app is deleted, and reinstalled again I'm getting a weird behaviour: that delegate method is called BEFORE user had a chance to accept or reject the prompt, right after it appears...
In my app I need to perform some UI action after a user accepts or rejects that prompt, and I don't see any other option other than using the above delegate method (and it seems not to work after re-install)
Any help is greatly appreciated.
I am wondering if this is intended by Apple that these lifecycle methods are called upon using TouchID functionality.
Is there any possibility to check if the touchID process is calling these methods (I want to avoid things like a BOOL in app delegate which is set if touchID input is currently shown or not..)
br
Im guessing the problem you're having is that you have code in applicationWillResignActive and applicationDidBecomeActive that affects the view controller that requests Touch ID-validation and that it sets off a tricky loop.
What you need to do is move those calls to applicationDidEnterBackground and applicationWillEnterForeground, because they're not invoked when the Touch ID-mechanism is called.
To explain the sequence, when your app starts the following sequence executes:
applicationDidBecomeActive
..other stuff your app does
Your app invokes Touch ID, which fires:
applicationWillResignActive
... Your app is disabled until the user verifies fingerprint (fails or
succeeds) ...
applicationDidBecomeActive
If you have code in applicationDidBecomeActive -or- applicationWillResignActive that affects Touch ID, you will create an endless loop or worse, you will create code that is riddled with flags and special cases.
Instead you should invoke Touch ID in two cases:
When your app starts (usually in didFinishLaunchingWithOptions)
When your app's applicationWillEnterForeground is called.
You can create a static bool in your login script that you can check from your AppDelegate!
static var isShowingTouchID = false
Then before your context.evaluatePolicy call, you can set it to true, and in the callback function, set it to false. I believe you use the reply argument to set a callback to this.
Then in your AppDelegate, check the status of this bool.
Originally I was using a public variable in AppDelegate and setting that, but I feel similarly in that I didn't want to do that. Frankly, I don't like this solution either, but it was the only one I could come up.
I even tried overriding viewDidDisappear in my login script, but I quickly found out that it was not being called even when I tapped "Cancel" on the touch ID prompt.
If anyone has a better solution, I would love to know.