views:

613

answers:

1

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

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

A: 

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.

greg
thnx for the response greg i really appreciate that u gone through my problemat the mine time i used the FBCONNECT framework to cover it allhttp://github.com/facebook/facebook-iphone-sdku can download the source code from here and then uploading/updating anything jst like clicks away....
yunas
and about the above code that I have mentioned.... I have generated the md5 code and yes the "StrSig and strSig" was a copy paste mistake here.... I appoligize for that... where as I have matched the string that is generated by md5 with the extrnal string on which I have applied md5...its all fine.... the error with this code is still unknown to me....
yunas
This problem was due to the fact, if some third party wants to update something on your behalf(through your account) then it has to ask or get your permission first.... this is the point where i was lacking and i wasnt able to see any update... :) though i solved that problem on the 23th march ... i thought to update it ....
yunas