This is an example of the code I get from Facebook to use custom objects. I created this with a special action to use the Facebook story.
Documentation for Facebook:
https://developers.facebook.com/docs/opengraph/overview/
NSMutableDictionary<FBGraphObject> *object = [FBGraphObject openGraphObjectForPostWithType:@"sotd_facebook:new_zombie" title:@"Sample New Zombie" image:@"https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png" url:@"http://samples.ogp.me/191078581053171" description:@""];; [FBRequestConnection startForPostWithGraphPath:@"me/objects/sotd_facebook:new_zombie" graphObject:object completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
I am curious how I can use this object for action in sos IOS for IOS. I tried using the following codes and crashing while creating an FBRequestConnection.
[__NSCFBoolean dataUsingEncoding:]: unrecognized selector sent to instance 0x3af00530 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean dataUsingEncoding:]: unrecognized selector sent to instance 0x3af00530'
[edit]
I created a FBOpenGraphObject and use the FBRequestConnection startForPostOpenGraphObject: completeHandler method. In the completion handler, I extract the identifier from the result and put it in another FBOpenGraphObject with the identifier. and he is still falling.
NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPostWithType:@"sotd_facebook:new_zombie" title:@"Sample New Zombie" image:@"https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png" url:@"http://samples.ogp.me/191078581053171" description:@""]; [FBRequestConnection startForPostOpenGraphObject:object completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { // handle the result // handle the result if (error) { NSLog(@"Error sharing story: %@", error.localizedDescription); } else if(result != nil) { NSLog(@"Result: %@", result); NSString* resultID = [result objectForKey:@"id"]; NSMutableDictionary<FBOpenGraphObject> *newObject = [FBGraphObject openGraphObjectForPost]; newObject.id = resultID; [FBRequestConnection startForPostWithGraphPath:@"me/objects/sotd_facebook:new_zombie" graphObject:newObject completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { // handle the result // handle the result if (error) { NSLog(@"Error sharing story: %@", error.localizedDescription); } else { NSLog(@"Result: %@", result); } }]; } }];
Crash Log:
2013-08-16 18: 47: 11.013 ZombieBlackout [3408: 907] - [__ NSCFBoolean dataUsingEncoding:]: unrecognized selector sent to instance 0x3a118530 2013-08-16 18: 47: 11.015 ZombieBlackout [3408: 907] * Application termination due to the uncaught exception "NSInvalidArgumentException", reason: '- [__ NSCFBoolean dataUsingEncoding:]: unrecognized selector sent to example 0x3a118530'
source share