通过iphone在facebook上传照片

时间:2010-03-20 13:15:38

标签: iphone facebook upload photo

你好我试图从我的应用程序上传我的图像但不能这样做.... 我试过了

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"];
[theRequest setURL:url];
[theRequest setRequestMethod:@"POST"];
[theRequest setPostFormat:ASIMultipartFormDataPostFormat]; 
[theRequest startSynchronous]; 

但它说签名不正确.... 哪里我错了请帮助我.....

1 个答案:

答案 0 :(得分:0)

this thread。如果“it”表示签名不正确,请检查生成strSig的行。以较小的块进行操作,以便您可以看到正在发生的事情并将NSLog的一些变量提供给控制台以提供帮助。如果上面的代码是直接复制/粘贴作业,则您有一行使用“StrSig”而不是“strSig”,这可能会发出警告或错误,因为Obj-C区分大小写。