I am implementing google plus sharing successfully by using the following lines of code. But after sharing it doesn't come back to initial screen. Is there any delegate call after completing the procedure of sharing
- (void)googelSharing{
//Set bool for Handler
[self setUserDefaultForSharing:NO];
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.clientID = kClientId;
signIn.scopes = #[#"https://www.googleapis.com/auth/plus.login"];
id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];
// This line will fill out the title, description, and thumbnail from
// the URL that you are sharing and includes a link to that URL.
[shareBuilder setURLToShare:[NSURL URLWithString:#"https://www.example.com/restaurant/sf/1234567/"]];
[shareBuilder open];
}
For your information Apple will reject the app if you use
a web page in mobile Safari for creating an account or logging in, then returns the user to the app.
See this discussion.
So Google release new Google Plus SDK for sign in
Google Sign In SDK 2.0 is documented on the new dev site :
https://developers.google.com/identity/sign-in/ios/
Hope this helps
It is not possible because when u request to open the specific web page iOS automatically transfer this request to Safari . And Safari will open that web page.
One thing you can do is used UIWebView in your app and open the web page inside UIWebView and u can easily get back to pervious viewController OR web page by adding simple UIButton in currentViewController class.
Here is code
UIWebView *webView = [[UIWebView alloc]init];
NSString *urlString = #"https://www.example.com/restaurant/sf/1234567/";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[webView loadRequest:urlRequest];
[self.view addSubview:webView];
If u are used UIWebView than refer this answer it will help you Back Button on UIWebView
Related
I am sharing my post on Facebook. I am sharing Image, Content URL, Description. I am using this code for sharing:
FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = self;
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentTitle = APP_NAME;
content.contentDescription = text;
content.imageURL = [NSURL URLWithString:[[arrAllEvents valueForKey:#"flyer_image"]objectAtIndex:0]];
content.contentURL = url;
dialog.shareContent = content;
dialog.mode = FBSDKShareDialogModeFeedWeb;
[dialog show];
I have enable Deep Linking (News Feed links launch this app) option for https://developers.facebook.com.
I have added my Fbid and URLShema Like this
<key>CFBundleURLSchemes</key>
<array>
<string>abcevent://</string>
<string>fb1......</string>
</array>
and add code in appdelegate.m for the same like this
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url,NSError *error){
if([[url scheme] isEqualToString:#"abcevent"])
{
[self callNewsletter:url];
}
}];
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
[FBSDKAppEvents activateApp];
}
Now if I am sharing my post on fb via application. That post click is not opening my app in iPhone Deep linking is not working.
Can anyone tell what other things I am missing with this?
The fetchDeferredAppLink method only works with ads. It never worked with links shared organically on the News Feed. You can read about more limitations of deep linking from Facebook in this blog post, but there are two core things to know:
Facebook has never supported deferred deep linking for non-paid content.
Facebook's App Links standard at one point supported normal deep linking (meaning if the app is already installed), but this has been broken on iOS for a long time.
If you want this sort of functionality, you'll need a separate solution like Branch.io (full disclosure: I'm on the Branch team).
Google plus SDK has been integrated in one of my apps for sharing the app content.
For this user has to login into Google plus account on the app and then use this sharing feature.
But, in the Google developer site it says that Google Plus login is deprecated and we need to implement Google login instead of Google Plus login.
I am not using Google Plus just for a login functionality.
So, what should i do now?
There's a GoogleSignIn SDK: https://developers.google.com/identity/sign-in/ios/start-integrating.
If you are just interested in sharing you should probably be using the SFSafariViewController to present the share dialog box in a webview:
- (void)showGooglePlusShare:(NSURL*)shareURL {
// Construct the Google+ share URL
NSURLComponents* urlComponents = [[NSURLComponents alloc]
initWithString:#"https://plus.google.com/share"];
urlComponents.queryItems = #[[[NSURLQueryItem alloc]
initWithName:#"url"
value:[shareURL absoluteString]]];
NSURL* url = [urlComponents URL];
if ([SFSafariViewController class]) {
// Open the URL in SFSafariViewController (iOS 9+)
SFSafariViewController* controller = [[SFSafariViewController alloc]
initWithURL:url];
controller.delegate = self;
[self presentViewController:controller animated:YES completion:nil];
} else {
// Open the URL in the device's browser
[[UIApplication sharedApplication] openURL:url];
}
}
I am loading one URL in UIWebView. It calls webViewDidFinishLoad delegate method but load an error page.
To load URL, I have used below code:
[customwebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:customURL]]];
Then I tried same URL in the Safari browser and it gets perfectly loaded.
This is the case only with iPhone4 with iOS 7.1.2.
I tried in simulator and device. Result is same.
Is there anything I need to set manually to load URL in UIWebView which is bydefault ON in Safari?
i was also not able to load urls like Facebook share dialog and twitter share.
But i got it fixed by encoding the url
use this :
NSString *encoded = [self.link stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:encoded]];
self.webView.delegate = self;
[self.webView loadRequest:request];
I have this code that return success = NO
[self.extensionContext openURL:[NSURL URLWithString:#"URLApp://"] completionHandler:^(BOOL success) {
[self.extensionContext completeRequestReturningItems:nil completionHandler:nil];
}];
So and I can't open containing app from my share extension when I debug it.
I've configured main target of contained app like this:
I've tested open URLApp:// from safari and it works for me.
I also used some examples provided here to understand how to open containing app using url scheme.
EDIT: Ok, just a little correction here. I got it working with placing a button over the label just like suggested above and the following code:
NSURL *url = [NSURL URLWithString:#"floblog://"];
[self.extensionContext openURL:url completionHandler:nil];
I linked it to a "Touch Up Inside" event. However, this also causes the app to launch when the user scrolls the Today view.
=======================================
I ran into the same issue. However, it seems that there is no solution for now since the release notes for the first beta of iOS 8 mention:
Known Issues: openURL does not work from an extension.
So I guess we will at least have to wait until beta 2.
I found this answer here by Julio Bailon:
UIWebView * webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
NSString *urlString = #"URLApp://";
NSString * content = [NSString stringWithFormat : #"<head><meta http-equiv='refresh' content='0; URL=%#'></head>", urlString];
[webView loadHTMLString:content baseURL:nil];
[self.view addSubview:webView];
[webView performSelector:#selector(removeFromSuperview) withObject:nil afterDelay:2.0];
How can I display face book feeds related to a group on an iOS App?
Is there any JSON/JSONP call to fetch the feeds??
Any help is Appreciated.
The simplest - is just to show a web page on web view. Facebook manages itself to fit the width of your webView control.
// Load facebook data
NSString *fbUrlAddress = #"http://www.facebook.com/FLORtiles"; // here you put your own group
//Create a URL object.
NSURL *fbUrl = [NSURL URLWithString:fbUrlAddress];
NSString *webHTMLfb = [NSString stringWithContentsOfURL:fbUrl encoding:NSUTF8StringEncoding error:NULL];
//NSLog(#"webHTML of facebook: %#", webHTMLfb);
//URL Requst Object
NSURLRequest *fbRequestObj = [NSURLRequest requestWithURL:fbUrl];
//Load the request in the UIWebView.
[fbWebView loadRequest:fbRequestObj];
You might need to get familiar with Facebook's Graph Api
Go through this -> https://developers.facebook.com/docs/mobile/ios/build/