I am able to read and write data from my iOS app(Central). Just after Delegate connectPeripheral:periphal is called, OS gives an alert asking for authentication PIN with two buttons "Cancel" and "Pair".
I am not able to get any notification when user presses "Cancel" or "Pair" button. I am also not able to detect if the pairing is successful or not.
self.peripheral.state always returns 2 (connected)
I have done some research to handling Cancel event of pairing popup but unfortunately apple doesn't provide any delegate to handle it.
Related
I'm receiving an incoming video-call (the app is in background), displaying system UI. When I slide to answer - call starts and there's a button to open the app. Can I somehow programmatically press this button on answering or suggest user to unlock his device without tapping app button?
Without use of a 3rd party API or a jailbroken iPhone, this is not possible. However, it would be possible to send a notification to the user to unlock their device.
I am presenting SKStoreReviewController.requestReview() and I want to have a boolean in UserDefaults which I would make true in case the user taps on Cancel.
Is there a way to determine if cancel was tapped considering this is a OS alert?
There isn’t a way to access which button was selected. I’m curious why you would you need this functionality? The OS will decide if the user should be shown the alert depending on a few factors including when the user last left a review or canceled.
Apple Developer Site:
https://developer.apple.com/documentation/storekit/skstorereviewcontroller/2851536-requestreview
Although you should call this method when it makes sense in the user
experience flow of your app, the actual display of a rating/review
request view is governed by App Store policy. Because this method may
or may not present an alert, it's not appropriate to call it in
response to a button tap or other user action.
I have read that addUIInterruptionMonitorWithDescription could be used to accept / tap on a particular button in a system alert. On recently trying some test code out, I was doing the following:
Adding a Photos Alert
Adding a Calendar Alert
Adding a Location Alert.
On the simulator, I was surprised to find that the Calendar and Location prompt automatically had their "Allow" buttons tapped. For the Photos prompt, the "Don't Allow" was hit. My question is - is there no need for addUIInterruptionMonitorWithDescription anymore? I tried using it for tapping on the dialogs but it didn't do anything. Even when I tried to hit another button on the alerts, I didn't see it working. How do I tap on the individual buttons on a system alert her?
If there is an alert on screen, and none of your interruption handlers handle it, XCTest will dismiss it for you if you are using Xcode <9.1.
To gain control of the alerts, you should create an interruption handler for each alert, returning true from the closure when (and only when) you have handled the alert that handler was intended for.
If the test tries all your alert handlers or receives a true return value from any of your handlers, and there is still an alert on screen, XCTest will handle the alert itself.
We initiate pairing with iPhone,
On iPhone a notification “Do you want to pair with this device” with 2 buttons “Pair” and “cancel” is displayed.
I need to click on this “Pair” button.
I notice that this notification displayed is not part of the any mobile (iPhone) application instead its system notification.
With the current tool, I am unable to click on this “Pair” button, hence can you please suggest an automation tool for iPhone which can perform click on this “Pair” button displayed as part of system notification?
its true you can not click buttons on alert and notification with inbuild automation. automation have inbuild functionality which cancel notification and alert by click on cancel
If you are using Instrument tool provided by apple then also it is possible to tap on "Pair". Only thing you need to do is register a callback for alert before your alert come. So limitation with this is if your alert come at starting point only then it is not possible with this tool but if this alert comes in between then definitely you can tap on "Pair".
You can see in UIAutomation doc hon how to register a callback for alert.
If not able to then I can help you more.
I am looking for a way to get notified about any user initiated touch event while my app is in background running state, I want to make it clear I don't want to handle gesture events or break UIResponder chain, some form of notification that user initiated a touch somewhere on the screen?
This isn't possible at all using the standard SDK. You would be able to record where the user is tapping in other applications and record what they are typing on the keyboard. This just isn't allowed. Only touches sent to your app can be intercepted and handled.
Not allowed. If an App is in the background it is only allowed to do few certain operations:-
Play music
Informing of their location at all times
Internet Protocol(VoIP)
Updates from external accessories
Must read section "App States and Multitasking" from Apple 's link below
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html
"It will surely give you strong Foundation "