Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-23-2011, 09:23 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 64
oztemel is on a distinguished road
Default sending text to own wall FACEBOOK

Hi,

I searched lots of thread but I couldn't find solution...

I checked my permissions. no problem.. and also passed developer.facebook stream test.. when I run my code, app ask my account info and ask for permissions.. and thats all. no message etc.. please help me what is wrong??

My code is:

Code:
-(IBAction)ShareFacebook:(id)sender{
    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if ([defaults objectForKey:@"FBAccessTokenKey"] 
        && [defaults objectForKey:@"FBExpirationDateKey"]) {
        facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
        facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
    }

    if (![facebook isSessionValid]) {
        
        
        NSArray *permissions = [[NSArray alloc] initWithObjects:
                                @"user_likes", 
                                @"read_stream",
                                @"publish_stream",
                                @"user_photos",
                                @"user_videos",
                                nil];
        [facebook authorize:permissions];
        
        [facebook authorize:nil];

        NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:7];
        
        [variables setObject:@"#Your Message" forKey:@"message"];
        [variables setObject:@"#http://Your Youtube Link" forKey:@"link"];
        [variables setObject:@"#This is the bolded copy next to the image" forKey:@"name"];
        [variables setObject:@"#This is the plain text copy next to the image.  All work and no play makes Jack a dull boy." forKey:@"description"];
        
        [variables setObject:@"#Your story" forKey:@"story"];
        [variables setObject:@"#http://Your Youtube Link" forKey:@"source"];
        [variables setObject:@"#Your caption" forKey:@"caption"];
        
        [facebook requestWithGraphPath:@"/me/feed" andParams:variables andHttpMethod:@"POST" andDelegate:self];


}
oztemel is offline   Reply With Quote
Old 12-23-2011, 11:31 AM   #2 (permalink)
Bringing fun to you
 
davidlxk's Avatar
 
Join Date: Dec 2011
Posts: 43
davidlxk is on a distinguished road
Default

you have to do it in an asynchronous manner ~

so the first thing you have to do is to make the class that you have the ShareFacebook method on follow the FBDialogDelegate,FBRequestDelegate and FBSessionDelegate protocol like this:

Code:
@interface newLayer : CCLayer<FBRequestDelegate,FBDialogDelegate,FBSessionDelegate>
after which you have to create the delegate method fbDidLogin so that in your ShareFacebook method where you call the
Code:
[facebook authorize:permissions];
, it will call the fbDidLogin delegate method when the user has successfully logon to Facebook.

btw ~ you called the authorize method twice when you should just call it once by passing in the permissions.

so if you want you can leverage on the Facebook SDK and show the post to wall dialog in the fbDidLogin method by using:
Code:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                           kFBAppID, @"app_id",
                                           linkUrl, @"link",
                                           picUrl, @"picture",
                                           name, @"name",
                                           desc, @"caption",
                                           caption, @"description",
                                           name,  @"message",
                                           nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
where params is a NSMutableDictionary where you have parameters for the App ID, link URL, picture URL, name, caption, description and message for the dialog.
__________________
Drop Dem is out now! You should check it out at http://itunes.apple.com/us/app/drop-dem/id490101113

You should follow Drop Dem on Twitter http://twitter.com/dropdemgame
or find us on Facebook http://www.facebook.com/pages/Drop-Dem/314923981881703
davidlxk is offline   Reply With Quote
Old 12-23-2011, 11:57 AM   #3 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 64
oztemel is on a distinguished road
Default

Quote:
Originally Posted by davidlxk View Post
you have to do it in an asynchronous manner ~

so the first thing you have to do is to make the class that you have the ShareFacebook method on follow the FBDialogDelegate,FBRequestDelegate and FBSessionDelegate protocol like this:

Code:
@interface newLayer : CCLayer<FBRequestDelegate,FBDialogDelegate,FBSessionDelegate>
after which you have to create the delegate method fbDidLogin so that in your ShareFacebook method where you call the
Code:
[facebook authorize:permissions];
, it will call the fbDidLogin delegate method when the user has successfully logon to Facebook.

btw ~ you called the authorize method twice when you should just call it once by passing in the permissions.

so if you want you can leverage on the Facebook SDK and show the post to wall dialog in the fbDidLogin method by using:
Code:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                           kFBAppID, @"app_id",
                                           linkUrl, @"link",
                                           picUrl, @"picture",
                                           name, @"name",
                                           desc, @"caption",
                                           caption, @"description",
                                           name,  @"message",
                                           nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
where params is a NSMutableDictionary where you have parameters for the App ID, link URL, picture URL, name, caption, description and message for the dialog.
but I dont want to see feed dialog page.. just I want to send some text and youtube links...
oztemel is offline   Reply With Quote
Old 12-24-2011, 12:11 PM   #4 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 64
oztemel is on a distinguished road
Default

Quote:
Originally Posted by davidlxk View Post
you have to do it in an asynchronous manner ~

so the first thing you have to do is to make the class that you have the ShareFacebook method on follow the FBDialogDelegate,FBRequestDelegate and FBSessionDelegate protocol like this:

Code:
@interface newLayer : CCLayer<FBRequestDelegate,FBDialogDelegate,FBSessionDelegate>
after which you have to create the delegate method fbDidLogin so that in your ShareFacebook method where you call the
Code:
[facebook authorize:permissions];
, it will call the fbDidLogin delegate method when the user has successfully logon to Facebook.

btw ~ you called the authorize method twice when you should just call it once by passing in the permissions.

so if you want you can leverage on the Facebook SDK and show the post to wall dialog in the fbDidLogin method by using:
Code:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                           kFBAppID, @"app_id",
                                           linkUrl, @"link",
                                           picUrl, @"picture",
                                           name, @"name",
                                           desc, @"caption",
                                           caption, @"description",
                                           name,  @"message",
                                           nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
where params is a NSMutableDictionary where you have parameters for the App ID, link URL, picture URL, name, caption, description and message for the dialog.
my viewdidload :
Code:
facebook = [[Facebook alloc] initWithAppId:@"XXXXXXXXXXX" andDelegate:self];
    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if ([defaults objectForKey:@"FBAccessTokenKey"] 
        && [defaults objectForKey:@"FBExpirationDateKey"]) {
        facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
        facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
    }
    
    if (![facebook isSessionValid]) {
          
        NSArray *permissions = [[NSArray alloc] initWithObjects:
                                @"user_likes", 
                                @"read_stream",
                                @"publish_stream",
                                @"user_photos",
                                @"offline_access",
                                nil];
        [facebook authorize:permissions];

    }
and share button is:

Code:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"icon_57" ofType:@"png"];
        NSData *videoData = [NSData dataWithContentsOfFile:filePath];
        NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                       videoData, @"GökhanYedier.png",
                                       @"img/png", @"contentType",
                                       @"Video Test Title", @"title",
                                       @"Video Test Description", @"description",
                                       nil];
       [facebook dialog:@"feed" andParams:params andDelegate:self];
when I running that code App permission ask appear. after that emptry feed dialog page appear.. my app never goes to fbDidLogin parts...

Code:
- (void)fbDidLogin {
    
    NSLog(@"Did Log In");
    NSLog(@"Access Token is %@", facebook.accessToken );
    NSLog(@"Expiration Date is %@", facebook.expirationDate );

    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:facebook.accessToken forKey:@"FBAccessTokenKey"];
    [defaults setObject:facebook.expirationDate forKey:@"FBExpirationDateKey"];
    [defaults synchronize];
    
}
oztemel is offline   Reply With Quote
Old 12-24-2011, 12:21 PM   #5 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 64
oztemel is on a distinguished road
Default

also my dont ask user name password.. just ask the permissions...
and getting that error:
how can I validate the session...???
Code:
2011-12-24 20:17:49.793 GokhanYedier[20414:207] The operation couldn’t be completed. (facebookErrDomain error 10000.)
2011-12-24 20:17:49.793 GokhanYedier[20414:207] Err details: Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x8451b30 {error=<CFBasicHash 0x8451820 [0x1fddb38]>{type = mutable dict, count = 2,
entries =>
	2 : <CFString 0x8451300 [0x1fddb38]>{contents = "type"} = <CFString 0x8451a10 [0x1fddb38]>{contents = "OAuthException"}
	3 : <CFString 0x84519b0 [0x1fddb38]>{contents = "message"} = <CFString 0x8451910 [0x1fddb38]>{contents = "An active access token must be used to query information about the current user."}
}
}
2011-12-24 20:17:49.794 GokhanYedier[20414:207] FB SESSION INVALIDATED!!!
oztemel is offline   Reply With Quote
Old 12-26-2011, 10:54 AM   #6 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 64
oztemel is on a distinguished road
Default

Hi,
I fixed my problems by bellowed tutorial...

How To Post on Facebook with Your iPhone App | Ray Wenderlich
oztemel is offline   Reply With Quote
Old 12-26-2011, 03:21 PM   #7 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 1
johnleo142 is on a distinguished road
Default

Well, congratulations if you fixed that. Have a nice day!
johnleo142 is offline   Reply With Quote
Reply

Bookmarks

Tags
facebook, feed, post, wall

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 394
13 members and 381 guests
7twenty7, AppsBlogger, Creativ, Dalia, David-T, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, teebee74, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:51 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0