用AFNetworking 步骤比较简单
</pre><pre name="code" class="objc">-(void)publish{
self.token =_landinView.token;
NSLog(@"access_token = %@",self.token);
NSString *str = self.textView.text;
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSDictionary *params = @{@"access_token": self.token,
@"status": str};
[manager POST:@"https://api.weibo.com/2/statuses/update.json" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
}
看下 新浪关于发微博的API
API 要求是POST 方式,和两个必填的参数 一个是accsess_token 和 status 。