我得到了一个用图片填充的PFQueryCollectionViewController
,在iOS 8.x.x及更低版本上一切正常,但当我在iOS 9上使用Xcode7Beta运行应用程序时,所有图片都是空白的。
下面是我用来从PFQueryCollectionViewController
中的解析加载图像的代码
- (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;
}
和
- (PFQuery *)queryForCollection {
PFQuery *query = [PFQuery queryWithClassName:@"Class"];
...
return query;
}
发布于 2015-07-22 04:59:18
这可能是由于解析器9对SSL的要求,因为解析器没有对文件使用iOS,所以它们不会正确下载。将info.plist设置为包括这样的密钥,这将关闭SSL requirements...at,当然风险自负:
<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>
发布于 2015-07-11 05:45:04
在相应目标的构建设置中找到Enable bitcode,并将其设置为NO
发布于 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
https://stackoverflow.com/questions/31078767
复制相似问题