ios 真机不能正常显示图片

我的项目里面,我保存opengl数据为png图片,到document文件夹,需要显示时用imageWithContentsOfFile,但是问题是在模拟器运行什么都好好的,在真机上运行就显示一片黑,在网上找了找解决办法都没能成功,跪求高手解答!!!图片说明图片说明

因为沙盒文件路径不同吧,你是存到main bundle的,还是document,library?这个会有影响的

这是我保存图片的代码

 UIImage *img = [self glToUIImageInRect:CGRectMake( 0, (_backingHeight-_backingWidth)/2+128,_backingWidth, _backingWidth * _videoH/_videoW)];

    //获取Documents目录
    NSArray *docPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [docPath objectAtIndex:0];

    //创建文件夹
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *myDirectory = [documentsDirectory stringByAppendingPathComponent:docDirName];
    if (![fileManager fileExistsAtPath:myDirectory]) {
        [fileManager createDirectoryAtPath:myDirectory withIntermediateDirectories:YES attributes:nil error:nil];
    }

    //创建文件
    NSDate *myDate = [[NSDate alloc]init];//获取系统当前时间
    NSDateFormatter *myDateFom = [[NSDateFormatter alloc]init];
    [myDateFom setDateStyle:NSDateFormatterNoStyle];
    [myDateFom setDateFormat:@"MMdd_HHmmss"];
    NSString *locationDate=[myDateFom stringFromDate:myDate];
    NSString *fileName = [NSString stringWithFormat:@"%@%@.png", locationDate,cameraName];
    NSString *filePath = [myDirectory stringByAppendingPathComponent:fileName];
    NSData *imgdata = UIImagePNGRepresentation(img);
    BOOL res = [[NSFileManager defaultManager] createFileAtPath:filePath contents:imgdata attributes:nil];
    if (res) {
        NSLog(@"文件创建成功,path:%@",filePath);
    } else {
        NSLog(@"文件创建失败");
    }

图片说明
你拖图片进工程的时候看看那个上面的Copy items if needed 你点对号了没有