Can you please help me determine the problem here?
It seems that I can't display the 3d file from cache directory. I'm having this error SceneKit IO: error, COLLADA files are not supported on this platform.
The zip file im saving in the cache directory contains .dae file and .png for the texturee. With Scene Kit you can:
Import COLLADA 3D objects and build scenes composed by cameras, lights, and meshes. https://developer.apple.com/library/mac/documentation/3DDrawing/Conceptual/SceneKit_PG/Introduction/Introduction.html
Thanks.
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
NSURL *url = [NSURL URLWithString:@"my url"
NSData *data = [NSData dataWithContentsOfURL:url options:0 error:&error];
if(!error)
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
NSString *zipPath = [path stringByAppendingPathComponent:@"zipfile.zip"];
[data writeToFile:zipPath options:0 error:&error];
if(!error)
{
ZipArchive *za = [[ZipArchive alloc] init];
if ([za UnzipOpenFile: zipPath]) {
BOOL ret = [za UnzipFileTo: path overWrite: YES];
if (NO == ret){} [za UnzipCloseFile];
NSString *floorFilePath = [path stringByAppendingPathComponent:@"house1.dae"];
NSURL *floorPathURL = [NSURL fileURLWithPath:floorFilePath];
dispatch_async(dispatch_get_main_queue(), ^{
SCNView *sceneView = (SCNView *)self.view;
sceneView = (SCNView *)self.view;
sceneView.allowsCameraControl = YES;
sceneView.autoenablesDefaultLighting = YES;
sceneView.backgroundColor = [UIColor whiteColor];
sceneView.scene = [SCNScene sceneWithURL:floorPathURL options:nil error:nil];
});
}
}
else
{
NSLog(@"Error saving file %@",error);
}
}
else
{
NSLog(@"Error downloading zip file: %@", error);
}
});