Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw request data #11

Merged
merged 3 commits into from
Jun 4, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions classes/PhFacebook.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ - (void) sendFacebookRequest: (NSDictionary*) allParams
NSDictionary *result = [NSDictionary dictionaryWithObjectsAndKeys:
str, @"result",
request, @"request",
data, @"raw",
self, @"sender",
nil];
[_delegate performSelectorOnMainThread:@selector(requestResult:) withObject: result waitUntilDone:YES];
Expand Down
2 changes: 2 additions & 0 deletions sample/FacebookTestAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
NSTextField *request_label;
NSTextField *request_text;
NSTextView *result_text;
NSImageView *profile_picture;
NSButton *send_request;
NSWindow *window;
}
Expand All @@ -25,6 +26,7 @@
@property (assign) IBOutlet NSTextField *request_label;
@property (assign) IBOutlet NSTextField *request_text;
@property (assign) IBOutlet NSTextView *result_text;
@property (assign) IBOutlet NSImageView *profile_picture;
@property (assign) IBOutlet NSButton *send_request;
@property (assign) IBOutlet NSWindow *window;

Expand Down
17 changes: 13 additions & 4 deletions sample/FacebookTestAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ @implementation FacebookTestAppDelegate
@synthesize request_label;
@synthesize request_text;
@synthesize result_text;
@synthesize profile_picture;
@synthesize send_request;
@synthesize window;

Expand Down Expand Up @@ -54,19 +55,27 @@ - (void) tokenResult: (NSDictionary*) result
[self.request_text setEnabled: YES];
[self.send_request setEnabled: YES];
[self.result_text setEditable: YES];
[fb sendRequest: @"me/picture"];
}
else
{
[self.result_text setString: [NSString stringWithFormat: @"Error: {%@}", [result valueForKey: @"error"]]];
}

}

- (void) requestResult: (NSDictionary*) result
{
[self.send_request setEnabled: YES];

[self.result_text setString: [NSString stringWithFormat: @"Request: {%@}\n%@", [result objectForKey: @"request"], [result objectForKey: @"result"]]];
if ([[result objectForKey: @"request"] isEqualTo: @"me/picture"])
{
NSImage *pic = [[NSImage alloc] initWithData: [result objectForKey: @"raw"]];
self.profile_picture.image = pic;
[pic release];

} else
{
[self.send_request setEnabled: YES];
[self.result_text setString: [NSString stringWithFormat: @"Request: {%@}\n%@", [result objectForKey: @"request"], [result objectForKey: @"result"]]];
}
}

- (void) willShowUINotification: (PhFacebook*) sender
Expand Down
Loading