0
我只是創建一個簡單的Facebook登錄應用程序,在我的viewdidload()方法中,我有權限,我得到的名稱,用戶名,電子郵件ID和個人資料圖片鏈接,但我想要做的是嘗試並下載該鏈接(URL)並在本地保存/下載。如何使用NSURLSession保存Facebook個人資料圖片?
剛開始使用x代碼和任何幫助,將不勝感激。
> - (void)viewDidLoad {
>
> [super viewDidLoad];
> FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init]; loginButton.center = self.view.center; [loginButton
> setDelegate:self];
> loginButton.loginBehavior=FBSDKLoginBehaviorWeb;
> [self.view addSubview:loginButton];
> loginButton.readPermissions = @[@"public_profile",@"email",@"user_friends",@"user_about_me",@"user_friends",@"user_birthday",@"user_hometown"];
> [email protected][@"publish_actions"];
> FBSDKLoginManagerLoginResult *result;
>
>
>
> {
> if ([result.grantedPermissions containsObject:@"email"]) {
> NSLog(@"%@",result);
> }
> }
>
> NSMutableDictionary* param = [NSMutableDictionary dictionary];
> [param setValue:@"id,name,email,picture.width(100).height(100),bio"
> forKey:@"fields"];
>
>
> NSURL *profilePictureURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/user/picture?type=large"]];
> NSURLRequest *profilePictureURLRequest = [NSURLRequest requestWithURL:profilePictureURL
> cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0f];
> // Facebook profile picture cache policy: Expires in 2 weeks
> [NSURLSession sessionWithConfiguration:profilePictureURLRequest delegate:self delegateQueue:nil];