Hy, i am trying to make from Facebook IOS SDK (Octomber 2011) a class of my own in where i can make all the methods and functions that i need and just import this class in any of my application view controllers and call it. So this way i don't need to do all the initialization and delegation to the controllers in where i use the facebook. So i want to do like this, [myfacebookclass initwithappID:myappid] [myfacebookclass postmessage:@"some message"];
The thing is when i am seting authorizeWithFBAppAuth:YES safariAuth:YES flags in facebook.m ( the original class) and i do a postmessage it redirects me on Facebook Application or Safari and check's for permision, i hit ok and then redirects me in my application and doesn't post message.
WHen i am trying to post message i do like this :
This is in my own facebook class
myfacebookclass *facebook2;
+(void)initWithAppID:(NSString*) facebookAppId {
if (facebook2 == nil) {
facebook2 = [myfacebookclass new];
[facebook2 setWithAppId:facebookAppId];
}
}
- (void) postMessage1:(NSString *)messageToPost {
if ([self.facebook isSessionValid]) {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.applicationID, @"api_key",
messageToPost, @"message",
nil];
[self.facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];
} else {
NSArray * neededPermissions = [[[NSArray alloc] initWithObjects:@"user_about_me", @"publish_stream", nil] autorelease];
[self.facebook authorize:neededPermissions];
}
}
+ (void)postMessage:(NSString*) message {
[facebook2 postMessage1:message];
}
I also implemented:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [facebook handleOpenURL:url]; }
i've didn't modified facebook.m or other classes in Facebook IOS SDK.