iOS detect action from UITextView with phone number being tapped - ios

iOS 7 and XCode 5.
I have a textview with a phone number that can be touched to make a call.
I have implemented the UIGestureRecognizer with a selector, but this "doesn't work" (more on that below)
The issue is this:
When I tap on the phone number on the device I get an alertview prompt "(phone) Cancel/Call"
Here's what I want to do:
I want to capture (for data collection purposes, not real behavior) whenever the user pushes the "call" button in the alertview.
The reason why the UIGestureRecognizer "doesn't work" is because the selector method only gets called if the user taps on the cancel button or taps on the phone link multiple times. Both of these cases are useless for me.
Any suggestions?
Note: I dont want to make a button to place the call since by doing this the OS takes me back to the phone app after the all instead of my app, like the textview does.

Related

How to tell when a iOS notification drop down goes away?

In my app, I have a pretty standard phone number verification screen. So the user enters their phone number then gets to a "verification" screen like so:
The system sends them an SMS message, and they get a notification:
If the user swipes down on this notification, they get the following screen:
Now when they're done and tap on the "X" icon, they get back to the verification screen, however the keyboard has disappeared:
Under normal circumstances, you could tap on the text field and the keyboard would come back, however I'd like to save the user that step and have the keyboard reappear automatically (and besides, the text fields in this case aren't tappable anyway).
I could try using the UIApplicationDidBecomeActive notification, but I thought there might be something else more elegant.
Add textfield firstResponder in viewWillAppear().
override func viewWillAppear(){
super.viewWillAppear(true)
self.tfVerification.becomeFirstResponder()
}

Delaying application while UIAlertView is active

I added an Alert view, asking for user input, at the start of my app. The app works fine without the Alert view. But with the code for the Alert view added, part of the UI is blacked out after hitting the 'ok' button on the alert.
I'm not well versed in ios, but is there a good way to delay the app from running until the Alert (text input) is completed (ok button pressed). This might avoid whatever is causing the screen to go black in one section. Apparently the app is executing while the alert is active, and the alert is affecting the UI. Basically, I am asking the user to input their phone number via an alert that will be used later in the app.
When alert view is shown on screen, getting back ground dimmed (reduced alpha) is a normal thing and is practiced by iOS.
However, if you feel some part of the code you want to run only on tap on OK button on alert, move that method call to OK button action handler.

Handle Selected Turns/Games in iOS Game Center App in Game Center Enabled App

I am creating a GKTurnBasedMatch Game Center-enabled app. I've successfully implemented GKLocalPlayerListener methods to listen for events, such as player:receivedTurnEventForMatch:didBecomeActive: and other methods. Additionally, if a user taps on an existing match in the GKTurnBasedMatchmakerViewController (for example, if showExistingMatches is set to YES), I can handle the event in the GKTurnBasedMatchmakerViewControllerDelegate method turnBasedMatchmakerViewController:didFindMatch:.
However, I want to handle tapping on the various controls to view a match within the iOS system Game Center app.
For example, if I navigate to the Game Center iOS pre-installed app (not my app), tap on the Turns tab, tap on the row for my app, tap on a match/turn, and then tap on "View Game" or "Accept Invite" or "Play your turn", I want to handle these match-specific actions in my app.
When these items are tapped, my app indeed launches, but as far as I can tell from reading the documentation, there is no way to get extra information about which match the user tapped, so I can appropriately show that match.
Apple has chosen to remove this feature.
Their documentation is inaccurate. I opened a bug with Apple to investigate further. Here is the disheartening proof.

iOS 6.1.5 UITextField - text not populating

My customer has a POS (Enterprise) app that was working fine on iPod6.1.3. Some of the devices were upgraded to 6.1.5 last week and began exhibiting a problem with taps on the keyboard not populating the UITextField. Unfortunately it is an intermittent problem and I do not have reliable steps to replicate, but I have seen it happen on a 6.1.5. device while running under the debugger. Here's what I know:
User taps on any of 7 UITextFields on the view. Keyboard slides up from bottom. Cursor starts blinking in the field.
User taps any key (including return). The key popover shows the key being pressed. Nothing appears in the UITextField.
Once the problem starts, it will persist until I quit the app (in this case, the app really quits with an exit(0) - required due to credit card security). Running the app again will most likely work correctly.
In the debugger, when things are working correctly I get callbacks to textFieldShouldBeginEditing:, textFieldDidEndEditing:, textFieldShouldReturn:, and textField:shouldChangeCharactersInRange:replacementString: as expected. When things don't work, I DO get callbacks for textFieldShouldBeginEditing: and textFieldDidEndEditing:, but I DO NOT get call backs for textFieldShouldReturn:, and textField:shouldChangeCharactersInRange:replacementString:. I checked the delegate for the UITextField in the shouldBegin and DidEnd methods - they are of course set to self.
Again, this behavior is new, and only in iOS6.1.5. There is nothing "fancy" going on in the view controller.
Any help would be appreciated.

IOS web view handling phone numbers

I am using UIWebView to show some data.
UIWebView is detecting phone numbers, which is fine, but when the user clicks on the phone number it is trying to fire a call directly.
Is there any way I can show an confirm message after a user clicks on a phone number, to allow the user to confirm they would like to place a call to this number?
Did you try to putting a breakpoint in shouldStartLoadWithRequest delegate method of UIWebview ? You might be able to catch the event click there.
There is no part of UIWebView that allows you to know when a phone number has been clicked. You will either have to turn of phone number detection or detect phone numbers yourself and convert them to links manually, so will have control over what happens when you click them.

Resources