Tag: azure cosmosdb

Azure DocumentDB通过Obj-c查询REST API时发生间歇性401错误

我负责使用REST APIscheme实现基于Objective-C的Azure DocumentDB系统的iOS查询。 利用在github上find的代码,特别是https://github.com/Azure/azure-storage-ios我能够生成一个适当的validation和返回适当的数据….有时。 问题:我间歇地收到来自服务器的401(authentication失败)错误响应。 通过Node.js做同样的请求不会遇到这种行为,所以我相信这是我的objective-c实现的问题。 – (NSMutableURLRequest *) RequestWithQuery:(NSString*)query Parameters:(NSArray*)parameters { NSError* error; NSDictionary* dictionaryOfBodyContents = @{@"query":query, @"parameters":parameters}; NSData* body = [NSJSONSerialization dataWithJSONObject:dictionaryOfBodyContents options:NSJSONWritingPrettyPrinted error:&error]; if(error != nil) { NSLog(@"AzureRequestWithQueryParameters error generating the body: %@",error); return nil; } char buffer[30]; struct tm * timeptr; time_t time = (time_t) [[NSDate date] timeIntervalSince1970]; timeptr = gmtime(&time); […]