NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mp4"];
NSLog(@"Path: %@", path);
NSURL *url = [NSURL URLWithString:path];
NSLog(@"URL: %@", url);
NSData *data = [NSData dataWithContentsOfURL:url];
NSLog(@"Data exists? %@", data ? @"yes" : @"no");
test.mp4 在我的包中,但这始终是输出
2013-03-13 11:50:29.444 videoAppPrototype[28625:907] Path: /var/mobile/Applications/D66DD820-4DE1-4E45-9495-9BACF130E368/videoAppPrototype.app/test.mp4
2013-03-13 11:50:29.446 videoAppPrototype[28625:907] URL: /var/mobile/Applications/D66DD820-4DE1-4E45-9495-9BACF130E368/videoAppPrototype.app/test.mp4
2013-03-13 11:50:29.448 videoAppPrototype[28625:907] Data exists? no
我不知道为什么,但数据永远不存在。