我正在尝试将UIImageView图像保存为png文件,然后将该文件用作GLTexture。我在这方面遇到了问题,当我试图在模拟器中运行我的代码时,Xcode说它成功了,但是模拟器崩溃了,没有错误消息。
下面是我的代码:
NSString *dataFilePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Picture.png"];
NSData *imageData = UIImagePNGRepresentation(imageView.image);
[imageData writeToFile:dataFilePath atomically:YES];
// Load image into texture
loadTexture("Picture.png", &Input, &renderer);发布于 2012-07-11 10:13:59
从你对Metalmi的回复来看,看起来你并没有给我们你正在编译的实际代码。如果你真的在做看起来像是在做的事情,那么你就是在尝试将数据写到你的应用程序包中,这将会失败,因为你被禁止去做那个。你能给我们提供你想要执行的确切代码吗?
发布于 2010-03-19 17:28:06
试试这个:
NSString *dataFilePath = [[NSBundle mainBundle] pathForResource:@"Picture" ofType:@"png"];https://stackoverflow.com/questions/2474901
复制相似问题