Hug*_*ugo 11 xcode objective-c uiimageview ios parse-platform
我有一个PFQueryCollectionViewController
填充图像,一切正常在iOS 8.xx及以下,但当我使用Xcode 7 Beta在iOS 9上运行应用程序时,所有图像都是空白的.
这是我用来从Parse中加载图像的代码 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;
}
Run Code Online (Sandbox Code Playgroud)
和
- (PFQuery *)queryForCollection {
PFQuery *query = [PFQuery queryWithClassName:@"Class"];
...
return query;
}
Run Code Online (Sandbox Code Playgroud)
aka*_*aru 10
这可能是由于iOS 9的SSL要求.由于Parse不对文件使用HTTPS,因此无法正确下载.设置info.plist以包含这样的密钥,这会关闭SSL要求......当然:风险自负:
<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>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2131 次 |
最近记录: |