iOS Displaying a pdf in WebView using Google Drive Doc View - ios

I explored many sites and obtained the following instruction that displays a pdf file in a very beautiful way.
[_pdfViewer loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString: #"http://docs.google.com/gview?embedded=true&url=http://gamersgold.com/wop-ios/uploads/eula_terms.pdf"]]];
However this URL is mainly used in Android apps:
http://docs.google.com/gview?embedded=true&url=
When using it the Google Docs caption is displayed at the bottom of the page. Would using this method cause my app to be rejected by the App Store?
Is there any alternative approach to achieve this in iOS that is provided or approved by Apple?

Using this http://docs.google.com/gview?embedded=true&url= will not get your app rejected.
Still if you have doubt, it is not necessary to use this URl. You can directly code like below and it will display the PDF in UIWebView object. You can say this is an alternative, infact, the default way to display a PDF file in UIWebView
[_pdfViewer loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString: #"http://gamersgold.com/wop-ios/uploads/eula_terms.pdf"]]];}

Related

WKWebView openurl in another application

I'm using WKWebView to show YouTube in my application.
When I load a youtube page it's sometimes open the YouTube App in my iPhone device.
This is the code I'm using:
NSURLRequest * req = [NSURLRequest requestWithURL:[NSURL URLWithString:#"https://www.youtube.com/"]];
[self.loginWebView loadRequest:req];
There is an option to detect the popup and prevent it?
I did want to post this as a comment but low rep won't let me. So, You might want to look at this topic:
Disable WKWebView for opening links to redirect to apps installed on my iPhone

GreyBox when interacting with PowerBI Embedded Report (WKWebView)

I'm trying to embed Power BI report & dashboard in a custom mobile app. I'm using webview (WKWebView) because I see there is no API besides Javascript to display the report in my (iOS) mobile apps. The embedded report is running, but i found this grey box when I try to interact with it and the user find it a little bit disturbing. (
check out this video
).
I put the html file in the asset (xcode project) and then load it into a WebView.
#property (strong, nonatomic) IBOutlet WKWebView *dashboardWV;
NSString *filePath=[[NSBundle mainBundle]pathForResource:#"BI" ofType:#"html" inDirectory:#"powerbi"];
NSURL *url = [NSURL fileURLWithPath: filePath];
NSURLRequest* request = [NSURLRequest requestWithURL:url];
[dashboardWV loadRequest:request];
Is there another way to embed the report to my mobile apps without webview / to get the same user experience with the PowerBI Mobile apps?
I see that the PowerBI Mobile App (unlike mine) run smoothly in the iPad without the Grey Boxes.
This is a known issue, we are working on fixing it (no ETA yet).

UIWebView not playing embedded stream mp4 video

I am trying to play a video from a website that I load inside my UIWebView in an iOS application developed with Objective C language.
When I hit the play button, I get an error message :
The video cannot be loaded, either because the server or network failed or because the format is not supported.
The code I've written for the web view is quite simple :
NSURL *url = [NSURL URLWithString:webSite];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webBrowser loadRequest:request];
The thing is that the same video is loading fine on Safari from the same device (iPad ).
Thanks!
(1) The video is not a web site. You might need to wrap it to a web page.
(2) If the video URL is not „https://„ it will fail playing since ios9 (?). You need to enable „Arbitrary Loads“ in your App‘s Info.plist.
Advice: Check option 2 first.

Web view is not loading for particular url

I am trying to load webview for the following url http://www.topchickw.com/ but blank screen occured but same code is working for other url's
NSURL *myUrl = [NSURL URLWithString:#"http://www.topchickw.com/"];
NSURLRequest *myUrlRequest = [NSURLRequest requestWithURL:myUrl];
[self.myWebView loadRequest:myUrlRequest];
Can any one suggest me how to load webview of the particular url
Thanks in Advance
I am not an HTML expert. It seems that the URL when loaded is playing a flash video (.swf file). iOS does not support flash. Hence the blank screen.
To cross check this I try opening the URL in mobile safari browser, it did not work.
Hope that helps!
Well this url if you open manually in browser you will get blank window only. Please check the issue is not in the code.
A flash file runs when this url is loaded into browser. The issue is not with code but with the website as iOS doesnot support flash.

How do I redirect back to calling app using ios custom URL scheme? [duplicate]

This question already has answers here:
How to redirect back to the caller app using custom url? [duplicate]
(2 answers)
Closed 9 years ago.
I have an app in which i want to open some already installed games on device.
For example I can open "Temple Run" using it's custom URL "templerun:/". Is there any way though to come back to my app from "Temple Run" which has custom URL suppose "testapp:/"?
Are there any other ways to achieve this, like using web view or something else?
You can't do this because other apps don't know and implement your app scheme. iOS doesn't supply such API by now.
x-callback-url is something match your want, appA open appB by scheme and appB callback-open appA. But this protocol is not official support by iOS.
That cannot be done .But you can use a webview inside app to show the webpage and do the rest
NSString *urlAddress = #”http://www.google.com”;
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];
Or just go for some call back uri API method .

Resources