2015-11-05 43 views
0

我有一個由Facebook配置文件獲取的圖像的URL。我獲取這些url並複製到字符串「urlpicture」。在url圖片我的網址顯示,但是當我傳入另一個文件中的字符串類型屬性「geturl」。當我進入另一個文件「geturl」時爲零。顯示Facebook的用戶配置文件圖像從URL到圖像視圖

這就是爲什麼我不能在圖像視圖上顯示圖像。我只能以字符串格式保存圖像網址。我應該在另一個視圖上顯示我的圖像。

  - (void) loginButton:(FBSDKLoginButton *)loginButton 
      didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result 
          error:(NSError *)error 
      { 
       FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] 
               initWithGraphPath:@"/me" 
               parameters:@{ @"fields": @"id,name,picture,email,gender"} 
               HTTPMethod:@"GET"]; 
       [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 
        // Insert your code here 
        NSLog(@"%@",result); 
        if ([result isKindOfClass:[NSDictionary class]]) 
      { NSDictionary *pictureData = [result valueForKey:@"picture"]; 
         NSDictionary *redata = [pictureData valueForKey:@"data"]; 
           _urlpicture = [redata valueForKey:@"url"]; 

        } 





       }]; 


       HomeViewController *pushWithSlot=[self.storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"]; 

       [self.navigationController setViewControllers:@[pushWithSlot] animated:YES]; 
       pushWithSlot.geturl=_urlpicture; 

回答

2

試試這個,導航

HomeViewController *pushWithSlot=[self.storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"]; 

pushWithSlot.geturl=_urlpicture; 
[self.navigationController setViewControllers:@[pushWithSlot] animated:YES]; 

上面一個沒有工作之前,實際上傳遞變量,嘗試這樣做的原因是URL裏面你塊

{ NSDictionary *pictureData = [result valueForKey:@"picture"]; 
        NSDictionary *redata = [pictureData valueForKey:@"data"]; 
          _urlpicture = [redata valueForKey:@"url"]; 

     // call after URL Fetch 
       HomeViewController *pushWithSlot=[self.storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"]; 

pushWithSlot.geturl=_urlpicture; 
[self.navigationController setViewControllers:@[pushWithSlot] animated:YES]; 
       } 

然後試試這個

{ NSDictionary *pictureData = [result valueForKey:@"picture"]; 
        NSDictionary *redata = [pictureData valueForKey:@"data"]; 
          _urlpicture = [redata valueForKey:@"url"]; 

     // call after URL Fetch 
       HomeViewController *pushWithSlot=[self.storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"]; 

pushWithSlot.geturl=pushWithSlot; 
[self presentViewController:pushWithSlot 
       animated:YES 
      completion:nil]; 
       } 
+0

先生,我在我的網址獲得價值BT我跳上相同的看法,如果我寫你的第二個代碼。它在相同的視圖導航.. –

+0

HomeViewController是你的另一個視圖控制器或相同的視圖控制器 –

+0

主視圖控制器是另一個視圖控制器,我想跳轉那些視圖控制器,但與退出按鈕 –

相關問題