首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在iOS 9上无法加载解析图像

在iOS 9上无法加载解析图像
EN

Stack Overflow用户
提问于 2015-06-27 01:20:15
回答 3查看 2.1K关注 0票数 11

我得到了一个用图片填充的PFQueryCollectionViewController,在iOS 8.x.x及更低版本上一切正常,但当我在iOS 9上使用Xcode7Beta运行应用程序时,所有图片都是空白的。

下面是我用来从PFQueryCollectionViewController中的解析加载图像的代码

代码语言:javascript
运行
复制
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {

    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];

    UIImageView *imageView = (UIImageView*)[cell viewWithTag:1];

    if([object objectForKey:@"image"] != NULL) {

        [[object objectForKey:@"image"] getDataInBackgroundWithBlock:^(NSData *imageData, NSError *error) {                

            UIImage *thumbnailImage = [UIImage imageWithData:imageData];
            UIImageView *thumbnailImageView = [[UIImageView alloc] initWithImage:thumbnailImage];

            imageView.image = thumbnailImageView.image;

        }];

        }

     return cell;

}

代码语言:javascript
运行
复制
- (PFQuery *)queryForCollection {

    PFQuery *query = [PFQuery queryWithClassName:@"Class"];   

    ...

    return query;
}
EN

回答 3

Stack Overflow用户

发布于 2015-07-22 04:59:18

这可能是由于解析器9对SSL的要求,因为解析器没有对文件使用iOS,所以它们不会正确下载。将info.plist设置为包括这样的密钥,这将关闭SSL requirements...at,当然风险自负:

代码语言:javascript
运行
复制
<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSExceptionDomains</key>
        <dict>
            <key>files.parsetfss.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSTemporaryExceptionMinimumTLSVersion</key>
                <string>TLSv1.1</string>
            </dict>
        </dict>
    </dict>
票数 10
EN

Stack Overflow用户

发布于 2015-07-11 05:45:04

在相应目标的构建设置中找到Enable bitcode,并将其设置为NO

票数 2
EN

Stack Overflow用户

发布于 2015-09-25 05:55:25

@akaru的答案效果很好。您可以使用this技巧通过https加载解析图像,而不是添加异常。从根本上说,这意味着用https://s3.amazonaws.com/替换http://。如下例所示:

Http:http://files.parsetfss.com/b05.../tfss-fa8-e541-...-jpg

Https:https://s3.amazonaws.com/files.parsetfss.com/b05.../tfss-fa8-e541-...-jpg

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31078767

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档