[英]Unable to read Images from xcode project in iPad IOS 10.2.1 64bit when download app from app store (testflight)
例如,無法從xcode項目讀取圖像。 將一張圖片拖放到xcode項目中,然后使用以下代碼閱讀。
__weak NSString * strTemp = [NSString stringWithFormat:@“%@ / s _%@”,[[NSBundle mainBundle] resourcePath],[[self.arr_gallery objectAtIndex:i] valueForKey:@“ filename_larger”]];
strTemp = [strTemp substringToIndex:[strTemp length]-3];
strTemp = [NSString stringWithFormat:@"%@png",strTemp];
// // NSString * strTemp = [[NSString alloc] initWithFormat:@“%@ / s_BGP001@2x.png”,[[NSBundle mainBundle] resourcePath]];
UIImage *image;
image = [[UIImage alloc] initWithContentsOfFile:strTemp];
img.image = image;
strTemp = nil;
編寫以下代碼。
NSString *newStrTemp = [strTemp stringByReplacingOccurrencesOfString:@"jpg" withString:@"png"];
而不是這個。
strTemp = [strTemp substringToIndex:[strTemp length]-3];
strTemp = [NSString stringWithFormat:@"%@png",strTemp];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.