开发者

upload photo at facebook via iphone

hello i am trying to upload my image from myapplication but not able to do so.... i have tried

ASIFormDataRequest *theRequest = [ASIFormDataRequest requestWithURL:url];

NSString *nowTimestamp = [NSString stringWithFormat:@"%f",[[NSDate date] timeIntervalSince1970]];

[theRequest setPostValue:kApiKey forKey:@"api_key"];
[theRequest setPostValue:(float)[[NSDate date] timeIntervalSince1970] forKey:@"call_id"];
[theRequest setPostValue:@"1.0" forKey:@"v"];
[theRequest setData:[NSString stringWithString:@"abc"] forKey:@"status"]; 
[theRequest setPostValue:[NSString stringWithFormat:@"%lld",session1.uid] forKey:@"uid"];
 NSLog(@"%lld",session1.uid);

 NSString *strSig = [[NSString alloc] init];

strSig = [strSig stringByAppendingString:[NSString stringWithFormat:@"@=%@",@"api_key",kApiKey]];
StrSig = [strSig stringByAppendingString:[NSString stringWithFormat:@"@=%@",@"call_id",nowTimestamp]];
strSig = [strSig stringByAppendingString:[NSString stringWithFormat:@"%@=%@",@"v",@"1.0"]];
strSig = [strSig stringByAppendingString:[NSString stringWithFormat:@"%@=%@",@"uid",[NSString stringWithFormat:@"%lld",session1.uid]]];

strSig = [strSig stringByAppendingString:kApiSecret];

[theRequest setPostValue:[self md5:strSig] forKey:@"sig"];
[theR开发者_运维问答equest setURL:url];
[theRequest setRequestMethod:@"POST"];
[theRequest setPostFormat:ASIMultipartFormDataPostFormat]; 
[theRequest startSynchronous]; 

but it says that signature is incorrect .... where i am wrong please help me.....


See this thread. If "it" says the signature is incorrect, check the lines where you generate strSig. Do things in smaller chunks so you can see what's going on and NSLog some variables to the console to help. If the code above is a direct copy/paste job, you have a line that uses "StrSig" instead of "strSig," which probably would issue a warning or error, as Obj-C is case sensitive.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜