简体   繁体   English

图像显示在模拟器中但不在设备中

[英]images are displaying in simulator but not in device

I am trying to load images from url and those images are displaying perfectly in simulator but not on the iphone.我正在尝试从 url 加载图像,这些图像在模拟器中完美显示,但在 iphone 上却没有。 Any ideas on what could be the problem?关于可能是什么问题的任何想法? here is code这是代码

uiImageView = [[UIImageView alloc] initWithFrame:CGRectMake(40, iImageViewStart, 200, iImageHeight-50)];

uiImageView.contentMode = UIViewContentModeScaleAspectFit;
[self downloadImageWithURL:url completionBlock:^(BOOL succeeded, UIImage *image) {
        if (succeeded) {
            uiImageView.image = image;
        }
    }];
[scroll addSubview:uiImageView];

cellForRowAtIndexPath cellForRowAtIndexPath

`UIImageView *iconImage = [[UIImageView alloc] initWithFrame:CGRectMake(5,5, 40, 40)];`
    [self downloadImageWithURL:url completionBlock:^(BOOL succeeded, UIImage *image) {
        if (succeeded) {
            iconImage.image = image;
            tmpImage = image;
        }
    }];
//iconImage.image =tmpImage;
iconImage.layer.cornerRadius=20;
iconImage.backgroundColor=[UIColor blackColor];
iconImage.contentMode=UIViewContentModeScaleAspectFit;
[cell.contentView addSubview:iconImage];`

didSelectRowAtIndexPath didSelectRowAtIndexPath

    FinalProdDisplay *FinalProdDisplayView = [ [FinalProdDisplay alloc] initWithNibName:@"FinalProdDisplay" bundle:nil];
Product *product = [ [Product alloc] init];
product= [arrayProducts objectAtIndex:[indexPath row]];
FinalProdDisplayView.strUrl=product.strProductImageUrl;

Please check your image names.请检查您的图像名称。 iOS Simulator is case insensitive ,while device is case -sensitive . iPhone模拟器是不区分大小写,而装置是敏感的情况下 So, double check image filenames.因此,请仔细检查图像文件名。

I checked server URL which was starting with http:// ....我检查了以 http:// 开头的服务器 URL ....

I replaced http with https and my images in iOS app started showing up.我用 https 替换了 http,我在 iOS 应用程序中的图像开始出现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM