2013-09-28 21 views
0

我正在使用iOS DataStore API将数据上传到StackMob。当我尝试使用用我的公钥初始化的smclient时,出现此错误。stackmob ios数据存储区http 401错误

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

回答

0

确保将权限设置为在您的堆栈移动数据库上打开。