我正在使用 iOS DataStore API 将数据上传到 StackMob。当我尝试使用用我的公钥初始化的 smclient 时出现此错误。
HTTP Code=401 "The operation couldn’t be completed. (HTTP error 401.)" UserInfo=0xa14dac0 {error=Insufficient authorization}
示例代码
[[self.smclient dataStore] createObject:eventDictObj
inSchema:@"EventSchema"
onSuccess:^(NSDictionary *object, NSString *schema)
{
NSLog(@"Created online event : %@", object);
successBlock();
}
onFailure:^(NSError *error, NSDictionary* object, NSString *schema)
{
failedBlock(error);
}];
并且smclient初始化如下
self.smclient = [[SMClient alloc] initWithAPIVersion:@"0" publicKey:@"xxxxxxxxxx"];
对于这个用例,我不需要使用登录的用户凭据在 StackMob 中创建此条目