1

アプリでセールスフォースにログインした後、productName や製品画像の URL などの属性を持つ製品のリストを返すサービス呼び出しを行っています。

このように商品画像のURLから画像をダウンロードしようとしています

SFOAuthCredentials *credentials =[SFAccountManager sharedInstance].credentials;

NSString *urlString = [NSString stringWithFormat:@"%@?oauth_token=%@",imageUrl,credentials.accessToken];

NSURL *imgUrl = [[NSURL alloc] initWithString:[URLString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
    NSURLRequest *imgRequest=[[NSURLRequest alloc]initWithURL:imgUrl];
    [NSURLConnection sendAsynchronousRequest:imgRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        UIImage *image=[[UIImage alloc] initWithData:data];
        NSLog(@"Image Object %@",image);
    }];

サイズが 1820 バイト前後のデータ オブジェクトを取得していますが、UIImage クラス メソッド [UIImage iamgeWithData:data] またはインスタンス メソッド [UIImage alloc] initWithData:data] を使用して NSData を UIImage に変換しているときに、null が取得されます。

誰でもこの問題を解決するのを手伝ってもらえますか?.

4

0 に答える 0