SystemSoundID ph
id sndpath = [[NSBundle mainBundle]pathForResource:@"end" ofType:@"wav" inDirectory:@"/"]
CFURLRef baseUrl = (__bridge CFURLRef)[NSURL fileURLWithPath:sndpath]
AudioServicesCreateSystemSoundID(baseUrl, &ph)
AudioServicesPlaySystemSound(ph)
由于Xcode和MacBook pro经常自己更新,所以我的自己的APP不打算走本地代理了,准备写到本地json1首先创建路径
//获取文件路径
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"路径名称" ofType:@"json"]
2读取data
//根据文件路径读取数据
NSData *data = [[NSData alloc] initWithContentsOfFile:filePath]
3data专程json
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]
options的几种类型
https://javenl.github.io/ios/2015/06/29/NSJSONSerialization.html
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)