我想创建一个简单的项目来研究xcode4.2上的ios5.0编程。这是原始代码:
NSString *path = [[NSBundle mainBundle] pathForResource:@"win" ofType:@"wav"];
NSURL* url = [NSURL fileURLWithPath:path];
AudioServicesCreateSystemSoundID( ( CFURLRef)url, &winSoundID);
编译错误:
file://localhost/Users/Hikari/Documents/Projects/Pickers/Pickers/CustomPickerViewController.m: error: Automatic Reference Counting Issue: Cast to 'CFURLRef' (aka 'const struct __CFURL *') of an Objective-C pointer to自动引用计数不允许使用非 Objective-C 指针
所以我在google上搜索过,有朋友说我必须添加宏'__bridge'来解决它,但这不起作用。
代码:
AudioServicesCreateSystemSoundID( ( __bridge CFURLRef)url, &winSoundID);
错误:
file://localhost/Users/Hikari/Documents/Projects/Pickers/Pickers/CustomPickerViewController.m:错误:语义问题:使用未声明的标识符“__bridge”
自动引用计数已启用!如何解决这个问题呢???