In ViewController i have button called registration for registor new user. And having textfield for enter userid, getstarted button take into ViewController1. If user click registration button UIWebview loads registration url from website link. After registration mail send to user with userid. Here what can i do after registration? shall i redirect to ViewController page for getstarted button. Shall i use navigation controller in UIWebview page for back. Sometimes apple will reject app that's why?
code:
webview=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320,568)];
NSString *url=#"http://myserver.net/projects/mobile/registration.php";
NSURL *nsurl=[NSURL URLWithString:url];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webview loadRequest:nsrequest];
[self.view addSubview:webview];
Apple doesn't allow it.Even Google store also rejects such apps. Use API's or open signup page in safari as:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://www.signuPpaage.com"]];
But in this case user will have to relaunch your app manually again after signing up.
Related
Here we are using UIWebview related application.
while clicking on some links, it's automatically connect(go) to the itunes.
but it's cannot get back to the app after clicking a itunes link (with out clicking on Exit).
My Question is, how can come back to the app after clicking a itunes.
Try this one uiwebview delegate method.
-(BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL* url = [request URL];
if (UIWebViewNavigationTypeLinkClicked == navigationType)
{
[[UIApplication sharedApplication] openURL:url];
return NO;
}
return YES;
}
I usually insert a button next to UIWebView.
Use a new view and insert button in any corner of view and then put your UIWebView, set your uiwebview is not fit to screen so you can push to exit button. When you tap to button than hide your view. ITs usually what i do for such situation, maybe it can help to you
When you click on any link and you now go to at this link of page and if you want to go previous to your application. Generally You can not go Back to your Application because Apple iOS does not provide this types of feature.
I am not sure but It may be possible in JB Device.
you can add custom tool bar at the top of your view and add back button to custom tool bar to come back to your app. Below to custom tool bar add your webview.Hope it will helps you.
If you are loading the webpage with Safri or you are opening iTunes app with custom schema, it is not possible, because you are leaving the app.
But yes you can do this, If you will load that itunes connect link through web view, and there you can place a custom back button to come back to your previous page.
For Example :
UIWebView *webView=[[UIWebView alloc]init];
[self.view addSubview:webView];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:#"http://www.xyz.com"]]];
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!!
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
In my app I have to load a web page in UIWebView where user can login with Facebook. The problem is that when user clicks login, blank page appears.
Is it possible to get back to first page and be logged in?
Web page works perfectly in Safari and opens new window and after login it closes it and gets back to where it left.
EDIT: wrong URL was provided to UIWebView
I think the sample of facebook SDK for iOS does the log in way you want.
Please refer to the link:
facebook-iOS-SDK-sample: https://github.com/facebook/facebook-ios-sdk/tree/master/sample/Hackbook
Especially this part in https://github.com/facebook/facebook-ios-sdk/blob/master/sample/Hackbook/Hackbook/RootViewController.m
/**
* Show the authorization dialog.
*/
- (void)login {
HackbookAppDelegate *delegate = (HackbookAppDelegate *)[[UIApplication sharedApplication] delegate];
if (![[delegate facebook] isSessionValid]) {
[[delegate facebook] authorize:permissions];
} else {
[self showLoggedIn];
}
}
When you click on log in button, it will open a login dialog, and ask for permission. This is what it looks like: https://developers.facebook.com/docs/mobile/screenshots/ios/#iphone-native
I think the best way to implement the "facebook-related" app is to start with the Hacbook. It is really a nice and detailed sample.
If you want to reload a specific url after the facebook login popup is closed to prevent being stuck on a blank page you can use this code.
First include the UIWebViewDelegate and set your delegate somewhere in your code.
[yourwebView setDelegate:self];
Then use the shouldStartLoadWithRequest method to check request url for close_popup.php which is used by Facebook to close their popup.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSString *urlString = [NSString stringWithFormat:#"%#", request];
if ([urlString rangeOfString:#"close_popup.php"].location == NSNotFound) {
//The close_pop.php is not found. (Do nothing)
} else {
//Facebook closed the popup so we should load the page we now want the user to see.
NSURL*url=[NSURL URLWithString:#"http://www.example.ca/thepageyouwanttoreload.html"];
NSURLRequest*request=[NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
return YES;
}
SSL issue? As per Joanne use the facebook SDK and you get loads of extra functionality for free, including logging in via the facebook native app if its installed.
I am making an app for a charity and Apple's review guidelines state that all donations must be made outside of the app in Safari, except for SMS donations, which we're not doing anyway. How do I make a button, that when tapped, goes to a specific URL in Safari? Thanks for your help!
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"your.website.here"]];
And put it in an IBAction for your button.
There might be a problem connecting to your site try this:
NSURL *url = [NSURLWithString:#"your.website.here"];
if (![[UIApplication sharedApplication] openURL:url])
NSLog(#"%#%#",#"Failed to open url:",[url description]);
They actually have a post on it here:
How can I launch Safari from an iPhone app?
You can use this code in button click event
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"your url"]];
it automatically opens in safari