Thanks you so much for this post.
However I tried to use your "FacebookAgent" code, but I am getting crash. May be I am not using it properly.
Following is my usage:
Code:
//Creating facebook agent instance.
facebookAgent = [[FacebookAgent alloc] initWithApiKey:@"<MY API KEY>" ApiSecret:@"<MY SECRET KEY>" ApiProxy:nil];
//Uploading image
UIImage* img = [UIImage imageNamed:@"1.png"];
[facebookAgent uploadPhotoAsData:(NSData*)img withCaption:@"hello" toAlbum:@"hello"];
For the above code I am getting following console log
Code:
[Switching to process 716]
2010-08-25 02:09:07.470 HelloFB[716:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'
*** Call stack at first throw:
(
0 CoreFoundation 0x0253b919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x026895de objc_exception_throw + 47
2 CoreFoundation 0x024f4078 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x024f3fea +[NSException raise:format:] + 58
4 CoreFoundation 0x0253a131 -[__NSCFDictionary setObject:forKey:] + 209
5 HelloFB 0x0000ed5a -[FacebookAgent uploadImage] + 199
6 HelloFB 0x0000f7d5 -[FacebookAgent session:didLogin:] + 653
7 HelloFB 0x00003f74 -[FBSession resume] + 707
8 HelloFB 0x0000d369 -[FBLoginDialog request:didLoad:] + 478
9 HelloFB 0x00005f25 -[FBRequest handleResponseData:] + 228
10 HelloFB 0x0000662a -[FBRequest connectionDidFinishLoading:] + 60
11 Foundation 0x00074666 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108
12 Foundation 0x000745bf _NSURLConnectionDidFinishLoading + 133
13 CFNetwork 0x022a29f1 _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 285
14 CFNetwork 0x0236bc72 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 402
15 CFNetwork 0x0236c0ea _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1546
16 CFNetwork 0x02297dfe _ZN19URLConnectionClient13processEventsEv + 100
17 CFNetwork 0x02297c95 _ZN17MultiplexerSource7performEv + 247
18 CoreFoundation 0x0251cd7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
19 CoreFoundation 0x0247b2cb __CFRunLoopDoSources0 + 571
20 CoreFoundation 0x0247a7c6 __CFRunLoopRun + 470
21 CoreFoundation 0x0247a280 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x0247a1a1 CFRunLoopRunInMode + 97
23 GraphicsServices 0x02c132c8 GSEventRunModal + 217
24 GraphicsServices 0x02c1338d GSEventRun + 115
25 UIKit 0x002e0b58 UIApplicationMain + 1160
26 HelloFB 0x00002998 main + 102
27 HelloFB 0x00002929 start + 53
28 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Any help is really appreciated.
Thanks in advance,
Madhu.