show app name on facebook share iPhone - iphone

I am using facebook.framework i want to share image using native facebook Dialog of iOS 6.0
I can share image but i want to show my app name.... like currently it showing via ios....
I6+
+65 want to show app name..Like via xyz... I am using below code.....
- (IBAction)publishButtonAction:(id)sender {
// Try and present the iOS Share Sheet
[FBDialogs
presentOSIntegratedShareDialogModallyFrom:self
initialText:#"" image:[UIImage imageNamed:#"iossdk_logo.png"]
url:[NSURL URLWithString:#"https://developers.facebook.com/ios"]
handler:^(FBOSIntegratedShareDialogResult result, NSError *error) {
NSString *alertText = #"";
if ([[error userInfo][FBErrorDialogReasonKey]
isEqualToString:FBErrorDialogNotSupported]) {
alertText = #"iOS Share Sheet not supported.";
} else if (error) {
alertText = [NSString stringWithFormat:
#"error: domain = %#, code = %d",
error.domain, error.code];
} else if (result == FBNativeDialogResultSucceeded) {
alertText = #"Posted successfully.";
}
if (![alertText isEqualToString:#""]) {
// Show the result in an alert
[[[UIAlertView alloc] initWithTitle:#"Result"
message:alertText
delegate:self
cancelButtonTitle:#"OK!"
otherButtonTitles:nil]
show];
}
}];
}

Unfortunately, you can't show your App Name if you want to use Facebook.framework and the iOS 6 default share dialog.
The only way to achieve this is to register an app on Facebook Developers and handle every connection/request using their iOS SDK.
Facebook.framework is the most straightforward way to deal with Facebook APIs but you have to renounce to your app name. Otherwise, you can take the harder way and build your app from scratch so you'll be able to show your app name. More info here: Facebook Share Dialog.

Related

How can I access the App Store without taking the user out of my app?

In a lot of iHandy apps, I have seen they advertise their other apps. Only when a user presses on the link, instead of being taken out of the app and into the app store, it appears a webview pops up presenting the app store. The user can then download the app with out ever leaving the app they was in.
Everything I have found on this so far, just takes me out of my app and into the native app store!
Does any one know how to present the appstore from inside an app with out having to close your app?
Thanks
You can use StoreKit.framework if your deployment target is equals or above iOS 6.0.
if(NSClassFromString(#"SKStoreProductViewController")) { // Checks for iOS 6 feature.
SKStoreProductViewController *storeController = [[SKStoreProductViewController alloc] init];
storeController.delegate = delegate; // productViewControllerDidFinish
// Example app_store_id
// [NSNumber numberWithInt:647623485];
NSDictionary *productParameters = #{ SKStoreProductParameterITunesItemIdentifier : appStoreID };
[storeController loadProductWithParameters:productParameters completionBlock:^(BOOL result, NSError *error) {
if (result) {
[self presentViewController:storeController animated:YES completion:nil];
} else {
[[[UIAlertView alloc] initWithTitle:#"Uh oh!" message:#"There was a problem displaying the app" delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles: nil] show];
}
}];
} else { // Before iOS 6, we can only open the URL
[[UIApplication sharedApplication] openURL:appStoreURL]
}
}

FBDialogs presentShareDialog does not work in both 5.1 and 6.1

id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:#"https://example.com/book/Snow-Crash.html"
forKey:#"book"];
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:#"books.reads"
previewPropertyName:#"book"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(#"Error: %#", error.description);
} else {
NSLog(#"Success!");
}
}];
I use the above codes to present a facebook shareDialog in my application ,but it does not work in both ios 5.1 and 6.1.I want to know the reason.
From my understanding as of now (I might be wrong), this code invokes the facebook native iOS app. If you are testing this on the simulator and don't have the iOS app installed, this will not work. It is unlikely you will be able to test this on the simulator. Try it on a real device that has the facebook iOS app installed.
Do you have the latest Facebook app installed?
Also, you're trying to post an open graph action using facebook's example action, which I'm not sure even exists. If you have registered custom open graph actions with you app, I suggest you modify your code to invoke it instead. If you don't have custom actions, I suggest starting with posting simple urls to see if it works for you.
Use:
NSURL* url = [NSURL URLWithString:#"https://developers.facebook.com/"];
[FBDialogs presentShareDialogWithLink:url
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(#"Error: %#", error.description);
} else {
NSLog(#"Success!");
}
}];
And lastly I suggest you read this: https://developers.facebook.com/ios/share-dialog/

Google+ check-in location in ios

I want to implement location check-in feature in ios. My application is using google+ ios sdk. The problem which I am facing is that after I have implemented google+ check-in feature then that post is not being displayed on my google+ account.
The technique which I have tried and implemented is written below.
-(IBAction)checkIn
{
GTMOAuth2Authentication *auth = [GPPSignIn sharedInstance].authentication;
GTLServicePlus* plusService = [[GTLServicePlus alloc] init] ;
plusService.retryEnabled = YES;
[plusService setAuthorizer:auth];
GTLPlusMoment *moment = [[GTLPlusMoment alloc] init];
moment.type = #"http://schemas.google.com/CheckInActivity";
GTLPlusItemScope *target = [[GTLPlusItemScope alloc] init] ;
target.url =#"https://developers.google.com/+/plugins/snippet/examples/place";
moment.target = target;
GTLQueryPlus *query =
[GTLQueryPlus queryForMomentsInsertWithObject:moment
userId:#"me"
collection:kGTLPlusCollectionVault];
[plusService executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
id object,
NSError *error) {
if (error) {
GTMLoggerError(#"Error: %#", error);
NSString *failure =
[NSString stringWithFormat:#"Status: Error: %#", error];
NSLog(#"%#",failure);
} else {
NSString *result = #"CheckedIn Saved in Google+";
NSLog(#"%#",result);
}
}];
}
Can any one please help me out. Is this the right way of implementing location check-in feature of google+ or is there any other method for it?
The method you're using is writing an "app activity" to Google+, which stores a "moment" in the user's app activity vault. As noted on https://developers.google.com/+/mobile/ios/app-activities these moments are not directly visible on the user's stream, although users may choose to share them to the stream if they wish.
To see the moments that have been shared, you will need to use the desktop app. Your profile has a list of apps that are using the Google+ Sign-In and you can view, share, and delete the activities for each of these apps. The mobile Google+ clients don't let you view the activities yet.

i want to store some data in "EverNote" through our app

i want to store some data in "EverNote" through our app either (image or text or both).
I googled, i got some guidance like EverNote SDK and i got the EverNoteCounter Sample also(When i run this, when i click getCount button it shows an alert message "Could not authenticate").
I generated the developer token also.
But i unable to create the consumerKey,consumerSecret. And also i did not find how to store our data to evernote from our app.
I got some links like this one
but when i go through that link it says( HTTP method GET is not supported by this URL)
I able to authenticate with the EVERNOTE and i able to get the number of notebooks in that Account.
I am using sqllite in my app. i am using one folder for images. Sqllite have the images links info.
How to store the data.
I used the following code to authenticate and to get the count
- (IBAction)retrieveUserNameAndNoteCount:(id)sender
{
// Create local reference to shared session singleton
EvernoteSession *session = [EvernoteSession sharedSession];
[session authenticateWithViewController:self completionHandler:^(NSError *error) {
// Authentication response is handled in this block
if (error || !session.isAuthenticated) {
// Either we couldn't authenticate or something else went wrong - inform the user
if (error) {
NSLog(#"Error authenticating with Evernote service: %#", error);
}
if (!session.isAuthenticated) {
NSLog(#"User could not be authenticated.");
}
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:#"Error"
message:#"Could not authenticate"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil] autorelease];
[alert show];
} else {
// We're authenticated!
EvernoteUserStore *userStore = [EvernoteUserStore userStore];
// Retrieve the authenticated user as an EDAMUser instance
[userStore getUserWithSuccess:^(EDAMUser *user) {
// Set usernameField (UILabel) text value to username
[usernameField setText:[user username]];
// Retrieve total note count and display it
[self countAllNotesAndSetTextField];
} failure:^(NSError *error) {
NSLog(#"Error retrieving authenticated user: %#", error);
}];
}
}];
}
- (void)countAllNotesAndSetTextField
{
// Allow access to this variable within the block context below (using __block keyword)
__block int noteCount = 0;
EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];
[noteStore listNotebooksWithSuccess:^(NSArray *notebooks) {
for (EDAMNotebook *notebook in notebooks) {
if ([notebook guid]) {
EDAMNoteFilter *filter = [[EDAMNoteFilter alloc] init];
[filter setNotebookGuid:[notebook guid]];
[noteStore findNoteCountsWithFilter:filter withTrash:NO success:^(EDAMNoteCollectionCounts *counts) {
if (counts) {
// Get note count for the current notebook and add it to the displayed total
NSNumber *notebookCount = (NSNumber *)[[counts notebookCounts] objectForKey:[notebook guid]];
noteCount = noteCount + [notebookCount intValue];
NSString *noteCountString = [NSString stringWithFormat:#"%d", noteCount];
[noteCountField setText:noteCountString];
}
} failure:^(NSError *error) {
NSLog(#"Error while retrieving note counts: %#", error);
}];
}
}
} failure:^(NSError *error) {
NSLog(#"Error while retrieving notebooks: %#", error);
}];
}
Please suggest me the links or give me the guidance
Thanks a lot in advance
Developer token is to be used when you only need to access your own account. To get a consumer key/secret, go here : http://dev.evernote.com/documentation/cloud/ .
If you are using iOS, https://github.com/evernote/evernote-sdk-ios has a sample app that you can use once you have a consumer key and secret.
In general, there is a lot of information on dev.evernote.com.
All SDKs are located at https://github.com/evernote
Getting started guide for iOS : http://blog.evernote.com/tech/2012/05/24/evernote-sdk-integration-ios/
Did you solved it? If not, i did the following to get it work:
download and include sdk
get consumerKey and secret (if you want to access notes too, then
instead of basic you should request for full access, http://dev.evernote.com/documentation/cloud/ top right corner)
Add the URLType entry in info.plist ("Modify your application's main
plist file" chapter https://github.com/evernote/evernote-sdk-ios)
Copy the session init code (filled with consumer key and secret, the hostname should be left unchanged) and implement the two application delegate specific code
An (on-screen) viewcontroller should be passed on authenticating the user to authenticateWithViewController method, f.e. the appdelegate's rootViewController
Study this pages to understand the model hierarchy used by Evernote:
http://dev.evernote.com/documentation/cloud/chapters/data_structure.php
http://dev.evernote.com/documentation/reference/Types.html
Image could be stored as EDAMResource (Resource) in the field data and text as EDAMNote (Note) in the field content. Both is handled by Evernote SDK's EvernoteNoteStore object.

To display permission page in facebook of iphone

I am new to iphone development, i want to display the permission page after logging facebook.
buttonIndex is the index of my actionsheets.
if(buttonIndex == 1)
{
session = [FBSession sessionForApplication:#"My App key" secret:#"My Key" delegate:self];
FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:session] autorelease];
[dialog show];
}
by using those code successfully loggin to facebook, but i want to permission page to display,
so i can use,
- (void)session:(FBSession*)session didLogin:(FBUID)uid
{
NSLog(#"User with id %lld logged in.", uid);
FBPermissionDialog* dialog1 = [[[FBPermissionDialog alloc] init] autorelease];
dialog1.delegate = self;
dialog1.permission = #"uid";
[dialog1 show];
}
But its not working. Where can i put that code.
And I want to share my content after the permission allowed.
If i logout the facebook, it goes to the browser but i want to return my application after logout,
Please help me out, guide me plz.
I would change this dialog1.permission = #"uid"; to something like this
dialog1.permission = #"publish_stream";. Because you want to publish your content to the users stream, right?
- (void)session:(FBSession*)session didLogin:(FBUID)uid
After loggin in I would first check if you might already have the permission to publish to the user's stream, by creating a FBRequest
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: #"publish_stream", #"ext_perm", nil];
[[FBRequest requestWithDelegate:self] call:#"facebook.users.hasAppPermission" params:params];
The result you can evaluate here
- (void)request:(FBRequest*)request didLoad:(id)result
e.g. like this
if ([request.method isEqualToString:#"facebook.users.hasAppPermission"])
{
NSString *success = result;
if ([success isEqualToString:#"1"])
{
NSLog(#"User has app permission");
// publish content now
...
}
else
{ // else ask for permission, opening permission dialog
...
}
I highly recommend this guy's tutorial, Brandon Treb, on integrating Facebook. He does a very thorough presentation and takes you line-by-line, so if it does not work, its a typo on your part. His tutorial got me up and running in less than two hours.
http://brandontreb.com/