前置動作
將檔案丟到專案裡面,記得Add to targets的第一個要打勾,不然會找不到檔案
程式範例
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"Holy place of stargazers.mp4" ofType:nil];NSLog(@"file path: %@",filePath);
NSData *shareData = [NSData dataWithContentsOfFile:filePath];
float shareDataSize = shareData.length;
NSLog(@"share data file size: %.2f , %.2f MB",shareDataSize,shareDataSize/1024.0f/1024.0f);
沒有留言:
張貼留言
留個話吧:)