开发者

Get photo from Salesforce after authentication

I'm using the ZKSforce library to connect to Salesforce with OAuth.

I run the following query which returns the proper values:

Select Id, Name, Username, Email, Phone, Division, FullPhotoUrl from User

I send try to download the Ful开发者_JAVA技巧lPhotoUrl from the path (which is correct) the following way using API 21, but I get null...

UIImage * img = [UIImage imageWithData:[NSData dataWithContentsOfURL:
        [NSURL URLWithString:[(ZKSObject*)[records objectAtIndex:indexPath.row]
        fieldValue:@"FullPhotoUrl"]]]];

Do you know how I could download the FullPhotoUrl from Salesforce once I have made a successful connection?

Tia,

S.


You need to add the oauth token or sessionId to the url to authenticate the request, add ?oauth_token=<insert valid session id/OAuth token> to the URL, see this blog post for more info.

There's a sessionId property on the ZKSforceClient object you can use to access the current sessionId.

Also, I can't remember if the FullPhotoUrl returns an absolute or relative URL, if its relative, you're going to need to build an absolute version of the URL first.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜