您好我正在使用Salesforce mobile.I必须在我的iphone应用中查看salesforce附件。因为我成功获得了访问令牌。 现在我想把salesforce中的附件二进制数据附加到我的iphone应用程序中 但无法得到我收到此错误
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
这是我的代码
NSMutableURLRequest *blobRequest=[[NSMutableURLRequest alloc]init];
NSString *blobPost = [NSString stringWithFormat:@"Authorization=OAuth%@",access_token];
NSData *blobpostData = [blobPost dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *blobpostLength = [NSString stringWithFormat:@"%d", [blobpostData length]];
NSURL *blobUrl=[NSURL URLWithString:@"https://ap1.salesforce.com/services/data/v23.0/sobjects/Attachment/00P90000004TRoWEAW/Body"];
[blobRequest setURL:blobUrl];
[blobRequest setHTTPMethod:@"POST"];
[blobRequest setValue:blobpostLength forHTTPHeaderField:@"Content-Length"];
[blobRequest setValue:@"Base64" forHTTPHeaderField:@"Content-Type"];
[blobRequest setHTTPBody:blobpostData];
NSError *blobError;
NSURLResponse *blobresponse;
NSData *blobData=[NSURLConnection sendSynchronousRequest:blobRequest returningResponse:&blobresponse error:&blobError];
NSString *dataresponse=[[NSString alloc]initWithData:blobData encoding:NSUTF8StringEncoding];
答案 0 :(得分:0)
嗨yogibhoi错误说明了一切,我认为你的会话已经过期了,