如何将对象c转换为rubymotion以获取Facebook用户的信息

时间:2015-10-04 14:55:14

标签: rubymotion

我试图翻译部分目标-c但我仍然坚持部分目标

任何想法?非常感谢

objective c version

  

if([FBSDKAccessToken currentAccessToken]){         NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@" picture",@" fields",nil];         FBSDKGraphRequest * request = [[FBSDKGraphRequest alloc]                                       initWithGraphPath:@"我"                                       参数:PARAMS                                       列举HTTPMethod:@" GET"];         [请求startWithCompletionHandler:^(FBSDKGraphRequestConnection *连接,                                               id结果,                                               NSError *错误){             UIImage * downloadedImage = [UIImage imageWithData:pictureData];             dispatch_async(dispatch_get_main_queue(),^ {                 self.profilePictureImageView.image = downloadedImage;             });

  }];
     

}

红宝石动作版

  

if(FBSDKAccessToken.currentAccessToken){

request = FBSDKGraphRequest.alloc.initWithGraphPath("me", parameters:nil, HTTPMethod: "GET")
     

}

1 个答案:

答案 0 :(得分:0)

最后,我想出了rubymotion中的相应代码

如果有任何错误,请直接纠正我,现在对我有用

原始目标-c

的一部分
root@armenubuntudev:~/Dockers/set-env# docker build -t ashimoon/envtest .
Sending build context to Docker daemon 3.584 kB
Sending build context to Docker daemon 
Step 0 : FROM ubuntu
 ---> 91e54dfb1179
Step 1 : ADD proxies.env proxies.env
 ---> Using cache
 ---> 181d0e082e65
Step 2 : RUN export `cat proxies.env` && echo "FOO is $FOO and BAR is $BAR"
 ---> Running in 30426910a450
FOO is 1 and BAR is 2
 ---> 5d88fcac522c
Removing intermediate container 30426910a450
Successfully built 5d88fcac522c

通过ruby_motion_query转换版本

if ([FBSDKAccessToken currentAccessToken]) {
       FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                     initWithGraphPath:@"me"
                                     parameters:params
                                     HTTPMethod:@"GET"];
       [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                             id result,
                                             NSError *error) {
       }];
   }