找到如图所示:
输入所创建的图片库名称
(1.)"Base SDK" 设置为 "Latest iOS (iOS 11.2)" (Xcode 9.2为例)
"Build Active Architecture Only" 设置为 "YES"
(2.)Installation Directiotory 删除掉后面的路径
(3.)Code Signing Identity 选择 Don't Code Sign
(4.)"iOS Deployment Target" 设置为 iOS 8.0 (为了兼容性,最好选择最低版本)
(5.)"Skip Install" 设置为 "NO"
(6.)"Strip Debug Symbols During Copy" 中"Release"模式设置为 "YES"
(7.) "COMBINE_HIDPI_IMAGES" 设置为 "NO"
(第一种方法)
UIImageView *imgView=[[UIImageView alloc] initWithFrame:CGRectMake(50, 50, 50,50)]; UIImage *image = [UIImage imageNamed:@"Image.bundle/Add.png"]; [imgView setImage:image];
(第二种方法)
UIImageView *imgView=[[UIImageView alloc] initWithFrame:CGRectMake(50, 50, 50,50)]; NSString *bundlePath = [[ NSBundle mainBundle] pathForResource:@"Image" ofType :@"bundle"]; NSBundle *bundle = [NSBundle bundleWithPath:bundlePath]; NSString *imgPath = [bundle pathForResource:Add ofType:@"png"]; UIImage *image=[UIImage imageWithContentsOfFile: imgPath]; [imgView setImage:image];
因为是和SDK一起让别的公司共用的,没想到每个App打包上传都失败了,主要有以下几种提示:
有很多解决办法,我用的是最简单的办法:就是删除bundle里的执行文件:找到工程中的Image.Bundle,右键单击后 选择 "显示包内容",找到里面的info.plist文件 ,删除掉Executable file 字段,重新打包,上传应用商店就可以了。