Show FaceBook profile in my App - iphone

I want to show facebook profile in my app,
until now i use the method:
NSURL *url = [NSURL URLWithString:#"fb://profile/userId"];
[[UIApplication sharedApplication] openURL:url];
But i want to know if there is a possible to show the profile inside my app and not open facebook app for this.
I want to do it because the problem that when there is no FaceBook app in the iPhone so the user can't see the profile.

you can create a webView to display this.
Make the UIWebView, set the frame, add to view
load the page with that url, look into this function:
(void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL
and be sure to checkout the UIWebView class reference here: UIWebView Class Reference

Related

Reverse back to app from safari [duplicate]

This question already has answers here:
Return to app from safari
(4 answers)
Closed 9 years ago.
In my application I am calling an url in safari on a button click,I am using the following code
In safari I am using pay pal payment.Is there any chance to reverse back to my app after donate button click.
-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
if ( inType == UIWebViewNavigationTypeLinkClicked ) {
[[UIApplication sharedApplication] openURL:[inRequest URL]];
return NO;
}
return YES;
}
NO That is not possible in case of websites that you dont have control. Instead, you can open the link in your webview.
If you have developed website, you can redirect it to your app using custom URL. For details refer this tutorial
For your case i.e. Paypal, it is not possible
If you are trying to navigate from Safari to your app, you would need to have control of the web page that you send the user to. Create a button on the webpage that links to the custom URL scheme of your application. Then when the user clicks on the button, your app will open on the device.
Instead of using [[UIApplication sharedApplication] openURL:] method, you can open your website into website inside your viewcontroller, with back button.Thus you can go back into your app from safari..
Follow this snippet,
`NSURL *url = [NSURL URLWithString:<YOUR_URL>];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
webViewBrowser.delegate = self;
[webViewBrowser loadRequest:request];`
Enjoy Programming!!

Open WebView in Safari

Can someone tell me how I can make an IBAction that opens the current link in the WebView in Safari.
So ​​that all pages I open that WebView can be opened with that one button in Safari.
Thanks.
- (IBAction)openLink {
NSURL * currentURL = [myWebView.request URL];
[[UIApplication sharedApplication] openURL:currentURL];
}
This should mostly work for URLs loaded via loadRequest: or traversed from there but won't work for other local load methods like loadHTMLString:baseURL:

launch browser(safari)inside my app

I have the following code
NSURL *url = [NSURL URLWithString:#"workingUrl"];
[[UIApplication sharedApplication] openURL:url];
which currently loads the url correctly but when the user is done, they have to exit and go back into my app.
How can the browser be loaded from within my app?
Regards
You have to make a little browser yourself. Create a View Controller with a UIWebView and some buttons that tigger it's methods (forward, back, reload, etc).

How can I jump to the App Store from a UIWebView link in my iPhone app?

I want to take a user OUT of my app and into the App Store when they click on a link within a UIWebView in my app. But when I click on the link, nothing happens (sim AND device both). How can I jump to the App Store from a UIWebView link in my iPhone app?
BY THE WAY:
The link in my UIWebView html is as currently follows (minus the self-promotion)
Download Now
Hmm. Perhaps you’re right. In that case, simply use this function of the UIWebViewDelegate:
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType
Parse the NSURLRequest to see if it’s an iTunes link and if it is, do this:
[[UIApplication sharedApplication] openURL:someURL];
use code:
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:#"http://itunes.apple.com/xxxxx"]];

opening an URL in safari while iPhone button is clicked

I want to add a button to my iPhone application which will open an URL in safari on iPhone when clicked (my application will terminate right?)
Thanks.
Raihan
You need to use - (BOOL)openURL:(NSURL *)url in UIApplication.
UIApplication is a singleton, so your code would look something like this:
NSURL *url;
[[UIApplication sharedApplication] openURL:url];
Your app will close if you are simply opening in Safari.
You can, however, use a WebView control to embed the web browser in your app. This way your app will not terminate.