小编Bla*_*aze的帖子

如何创建实例数组?

我有一流的朋友

#import "Friend.h"
#import "AFJSONRequestOperation.h"
#import "UIImageView+AFNetworking.h"
#import "AFHTTPClient.h"

@implementation Friend

-(id)init {
    self = [super init];
    return self;
}

-(id)initWithSecret:(NSString *)theSecret
         userId:(NSString *)theUserId {
self = [super init];
if(self) {
    secret = theSecret;
    user_id = theUserId;
    /// get friends
    NSString *str = [NSString stringWithFormat:@"https://api.vk.com/method/friends.get?fields=first_name,last_name&uid=%@&access_token=%@", user_id, secret];
    NSURL *url = [[NSURL alloc] initWithString:str];
    NSURLRequest *friendRequest = [[NSURLRequest alloc] initWithURL:url];

    AFJSONRequestOperation *friendOperation = [AFJSONRequestOperation JSONRequestOperationWithRequest:friendRequest success:^(NSURLRequest *friendRequest, NSHTTPURLResponse *response, id JSON) {
        //converting to array
        NSArray *ar = [JSON valueForKey:@"response"];

        NSData …
Run Code Online (Sandbox Code Playgroud)

iphone nsarray ios afnetworking

2
推荐指数
1
解决办法
700
查看次数

标签 统计

afnetworking ×1

ios ×1

iphone ×1

nsarray ×1