superfell / zkSforce

Cocoa library for calling the Salesforce.com Web Services API
https://pocketsoap.com/osx/zksforce/
MIT License
76 stars 27 forks source link

Support automatic API version downgrade following OAuth flow auth. #52

Open SteveDCronin opened 5 years ago

SteveDCronin commented 5 years ago

Simon;

I updated my code to version 47 and got this error when trying to create a contact like so: [sfClient create:@[newSFContact] failBlock:^(NSError err) {...} completeBlock:^(NSArrayresult) {...}];

I'm not aware of setting an 'APIVersion' anywhere... Any thoughts on what I might be doing wrong? I successfully login and get the authHost=='https://login.salesforce.com/' with a normal looking refreshToken...

failBlock Exception:Error Domain=pocketsoap.com Code=-103 "UNSUPPORTED_API_VERSION: Invalid Api version specified on URL" UserInfo={SoapFaultCode=sf:UNSUPPORTED_API_VERSION, NSLocalizedDescription=UNSUPPORTED_API_VERSION: Invalid Api version specified on URL}

superfell commented 5 years ago

Salesforce is still rolling out the major release that includes API v47, so it sounds like you're on an instance that hasn't been upgraded yet. The API login flow will spot this and automatically downgrade to 46, but it doesn't do that on the OAuth flow. You can manually set your client to v46, see the preferedApiVersion property on the client object.

I'll look into what can be done on the OAuth flow side to help with this as well.

SteveDCronin commented 5 years ago

Hmm. I don't see a way to use the OAuth flow and ask the backend what version I should be using... If I manually set the version ideally I'd have to come back and remove that in the future, yes? Any notion on how long it will take Salesforce to complete rollout? Weeks?