setp1.
在api溝通中可以將資料放置 header or body 透過ssl
-(void)modifyWater:(WaterSync*)water uuid:(NSString*)uuid completionHandler:(void (^)(NSDictionary *retDic, NSDictionary *errorDic))handler{
NSString *path = [NSString stringWithFormat:@"v2/Drinkings"];
NSDictionary *dic = @{@"uuid": water.uuid, @"cc":water.amount, @"drinked_at":water.time, @"auth_token":[[PassionBeanAccount sharedAccount] authToken]};
[self setDefaultHeader:@"auth_token" value:[[PassionBeanAccount sharedAccount] authToken]]; //將token包入header
[self patchPath:path parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"ok");
[MyWeb handleJsonResponseWithDataWithCompletionHandler:handler error:nil data:responseObject];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[MyWeb handleJsonResponseWithDataWithCompletionHandler:handler error:error data:nil errorCode:[operation.response statusCode]];
}];
}
0 意見:
張貼留言