Error on TextView with detection phone number IOS 9 - uitextview

I'm testing my app on an iPod Touch running iOS 9 (on iOS 8.4 it was working for other functions: FaceTime, copy to contacts, etc.). I have a textview with phone number detection and I receive the following error:
Warning: Attempt to present <_UIRotatingAlertController: 0x16250e00> on whose view is not in the window hierarchy!
Assertion failure in -[UITextView startInteractionWithLinkAtPoint:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3505.16/UITextView_LinkInteraction.m:377
Any fix to this?

Not a perfect solution but very simple and may help a desperate developer:
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange {
[[UIApplication sharedApplication] openURL:URL];
return NO;
}
You will lose the Copy, Open URL, Cancel popover on long press but you SHOULD at least be able to open url same as you would previously. In iOS 9, this still opens a browser window inside your app for standard URLs (which is nice).
This seems like an Apple bug (posted to radar already).
We were seeing very similar error when trying to open links in a modal view since Apple is trying to display a new modal alert view. Outside of modal view data detection worked just fine in iOS 9 for us.

This looks quite similar to a bug we recently had to fix for PSPDFKit where presenting sheets did not work when the rootViewController was already presenting another controller. (Is your rootViewController maybe not set?)
You can read the source code here. This might help you to figure out where the issue is for you:
https://gist.github.com/steipete/b00fc02aa9f1c66c11d0f996b1ba1265
And please dupe rdar://26295020 so this will get hopefully fixed in time for iOS 10. (The bug exists since iOS 8 and was first reported on iOS 8b5.)

Related

WKWebView migration issues

Further to my earlier question
Migrating iOS Hybrid App from UIWebView to WKWebview
I have made good progress and only have a few loose ends to tidy up. The overall performance improvement over UIWebView is outstanding.
In UIWebView it was possible to set the focus on a text field programatically using
webView.keyboardDisplayRequiresUserAction = NO ;
However this is not available in WKWebView and ever since 2016 programmers have been developing an updating work arounds (swizzles) to overcome this.
I have tried implementing the latest of these I could find on Stack Overflow, which I found at https://stackoverflow.com/a/55344531/5948260
However as I am very inexperienced at coding in XCode please could someone tell me exactly how I add the above solution to my project. I have tried in vain to find examples of how exactly to do this i
on GitHub or elsewhere but to no avail.
So far I have tried copying the code provided in the above answer into a .m file and adding it to my project, but I got 20 or so errors, I then added an import statement for Foundation and most of these went away but XCode complained that it did not know what class WebViewInjection is. Also must there be a corresponding header file?. Must there be a corresponding interface statement? How does the method defined in the answer get invoked?
As I could not answer any of these, I also tried adding the method into my ViewController class. Whilst this was accepted with no errors, it had no effect on my app, ie. the keyboard did not come up automatically.
I would also want the webview to resize to appear above the keyboard and not to scroll to where the text field is as this seems a very messy solution to me.
All help very gratefully received.
I have now managed to get the keyboard displayed by adding
[self allowDisplayingKeyboardWithoutUserAction];
to viewDidLoad
I kept the allowDisplayingKeyboardWithoutUserAction method declaration inside my ViewController but changed the + infront of the method declaration to a - and this seems to have worked.
I still do not know how to resize the webview when the keyboard is displayed.

Simple UIWebView

I'm making a tab bar app and one of the tabs is a youtube channel. It works fine and is perfect but the one problem is when i click on the video it plays but only in the standard view and not in Landscape. Any ideas on how to fix. Im sure its really simple but i've been having no luck.
This question probably answers what you are trying to do:
Webview resizes automatically to portrait and landscape view in iphone
The key thing to take away from it is that you need your view controller to tell the app that it supports the other orientations, not just portait.
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orientation
{
return YES;
}

iOS5: UIWebView doesn’t display Gmail after some attachment files were opened

Is there any fix/workaround for the problem?
Summary:
On iOS5 devices/simulators, applications with UIWebView do not display Gmail after some kinds of attachment files were opened, such as .pdf, .txt, or .xml. I build some simple apps with UIWebView, which have the searchBar, the goBack button and so on. They work perfectly on iPhone 4.3 devices/simulators when they are built for iOS 4.3, but they do not on those of 5.0. The projects built for iOS5 also have the same problems.
Steps to Reproduce:
Build an app targeted for iOS 4.3 or 5.0 with UIWebView, which has at least a goBack button and a searchBar for URLs.
Run the app on an iOS5 device / simulator.
Log in to Gmail in the app.
Open a pdf (txt / xml) attachment of one of your emails.
(This problem does not happen when you open a Microsoft office file supported by UIWebView, such as word, excel and powerpoint.)
Go back to the previous page by pushing the goBack button, or enter the URL “http://mail.google.com” in the searchBar.
The UIWebView shows a white blank.
After that you can never see your Gmail page.
Expected Results:
You can go back to the previous email (when you push the goBack button), or go to the top of Gmail page (when you enter the Gmail URL).
Actual Results:
The UIWebView just shows a white blank, and never let you see any Gmail page.
Regression:
Occur:
- iOS Deployment Target 4.3, run on iOS 5.0 devices / simulators
- iOS Deployment Target 5.0, run on iOS 5.0 devices / simulators
Does Not Occur:
- iOS Deployment Target 4.3, run on iOS 4.3 devices / simulators
Thanks
I had the same problem but could not fix it. I suggest you one of the workaround.
If your UIWebView goes to "mail-attachment.googleusercontent.com" , the Go back
action is wrong. So when the URL is detected, you had better create another view and load the attachment on it. The second has the GO back button however when it is pushed down you discard the second view then return to the first view via IBAction method. It works on iOS4 and iOS5.
my sample code is following.
-(BOOL) firstView:(UIWebView *)view
shouldStartLoadWithRequest:(NSURLRequest *)req
navigationType:(UIWebViewNavigationType)nType{
NSString *strurl=[[[req URL] standardizedURL] absoluteString];
NSRange range=[strurl rangeOfString: #"mail-attachment" options:NSCaseInsensitiveSearch];
if (range.location!=NSNotFound){
Your2ndViewController *attView = [[Your2ndViewController alloc] initWithNibName:#"YourNibNameofAnothor" bundle:nil];
if(attView==nil){
return NO;
}
attView.wvc=self;//mark the first on the second to return the first one
[attView loadURLWithString:strurl];
[self.view addSubview:attView.view ];
[UIView commitAnimations];
[attView loadURLWithString:strurl];
return NO;//Not Load on the first view
}
return YES;//Load on the first view
}
Your 2nd View which is also UIWebView has a return button and it's handler is following
- (IBAction) returnParent:(id)sender
{
[self.view removeFromSuperview];//return to the first view
[UIView commitAnimations];
}

i see some strange code in the window that pops up in facebook sdk at my iphone

i use this code at my post window in facebook sdk in my iphone app
[mainDelegate._session dialog:#"feed" andParams:params andDelegate:self];
when the windows shows up i see the following code in the words i used for my description.
span class text_exposed_hide ... span span class text_exposed_showspan class text_exposed_hide ... span span class text_exposed_show
what is this code about? should be visible to me or not?
this code is no visible when i post to facebook!!! how do i get rid of it in the window anyone?
The code you see is so that Facebook can limit the amount of text displayed and show a More link when it's on Facebook. I don't know how to get rid of it yet, but am also experiencing it. I'll post a reply if I find out more.
Update: From what I can tell this only happens with the Description and not with the Caption. It didn't used to happen (I have apps that I haven't changed that also exhibit this behaviour) so will have to put it down to Facebook - no doubt they want us to switch to the Graph API instead (which doesn't have a preview!)

Blackberry application hangs and freezes on UI modification

I've written a Blackberry appliation with the Blackberry JDE, running on a 9000 simulator. I tested it a week or so ago and loaded it on a Blackberry 9000 phone, and everything worked just fine. Sometime between then and now, though, something went wrong.
My code does the whole moving arrow "loading things from the internet" or whatever thing, but no screens pop up. My original screen, which is just a MainScreen with a RichTextField doesn't load at all. This screen, at least, has most likely not changed in the passing week, so if something broke, it would be in one of the later screens/lines of code that it shouldn't even be getting to yet!
Is it possible that my .jad or .cod file are corrupted somehow? I noticed that when I first put code on my machine, I just stuck in the .cod file that Eclipse provided me. Then, last week, the .cod file it gave me didn't work, because it was ACTUALLY a zip file with a two .cod files inside of it. Using the .cod file with the same name as the .cod file they were in succesfully loaded my app. I did the same this time, and I don't get invalid cod file errors or anything, but the app is still as broken.
Is there some direction I should be looking? Is the issue likely to be in my code, the cod file, the phone, or somewhere completely else?
-Jenny
Edit: I've narrowed it down to the problem only occuring if I attempt to load a particular screen. My problem is that this screen is nearly identical to another screen that IS working just fine on the actual device. Both screens are generated from the same method (which makes a webservice call and gets XML back and parses it to populate the fields of the screen). The only difference is that the screen that is breaking is going to a different URL. This URL DOES work (both from a browser and from the simulated device), so I"m at a loss. The application doesn't seem to crash, (it's still running in the background), it just doesn't attempt to display anymore.
Edit:
Okay, I'm seeing some tunneling errors immediately after I load my app, (but before I execute any of my networking code). When i do execute my networking code, it works just fine, unless it happens to be for my "Rental" section. I commented out all calls to that, and made my menu item for Rentals simply make a print statement. The code behaves identically (it freezes, or displays a white screen after selecting the button). All other menu items work (including those that call threads or network methods). And the rentals menu sucessfully executes in the simulator.
private MenuItem _rentals = new MenuItem("My Rentals", 110,
10) {
public void run() {
//if the last thing I did was a rental
//just show the screen
//else, reload rentals
System.out.println("Rentals was selected");
displayError("Rentals was pressed");
// if(rental){
// System.out.println("It's a rental!");
// popScreen(getActiveScreen());
// pushScreen(_offeringsScreen);
// }else{
// System.out.println("Getting Rentals from scratch");
// RentalsThread _rThread = new RentalsThread();
// _rThread.start();
// }
}};
I'm at a complete loss here: The device debugger doesn't seem to even register me selecting the menu item, and not a single line of code executes! It just freezes! I'll try putting back in my RentalsThread call in the start of my program (which was also freezing) just to see if I can tease apart the problem with the Rentals Thread (which makes the Rental Screen), and the problem with the Rentals menu item.
Okay, I think I have this figured out.
1.) My code was still behaving identically even after commenting out everything because I wasn't rebuilding the .COD files (they automatically rebuild if you try to run it in the simulator, but don't when you're generating a .ALX file, for some reason).
2.) The code I had for generating the Rental Screen was adding things to said screen. Apparently this is all well and good on the simulator, but on the real device it's required that you do all graphics manipulation (even for graphics not yet displayed) in an event thread (I used invokeAndWait).
So, now everything seems to be working just fine. There wasn't anything wrong with my networking (nor did I think there was, because my other networking screen works just fine). I still don't know why I get all those weird tunneling network things before I start, but it doesn't seem to affect anything yet.
See also:
BlackBerry UI Threading - The Very Basics
BlackBerry threading model
several suggestions:
if you have some background work with resources like file IO or networking, app just may stuck there... provide error handling and try to debug app from device!
code signing, check latest code update for API which require signing. But since there are no errors this is doubtful.
To debug on device, run Blackberry Device Manager, attach phone to usb, in eclipse select project, Context Menu -> Debug As -> Blackberry Device.
See A50 How to Debug and Optimize
UPDATE I see "Tunnel failed" exception, so it's like network connection problem...
See tunnel failed in blackberry bold. why?
How to Configure Full Internet Access On BlackBerry
UPDATE Support - Application stops responding when opening a connection

Resources