gpt4 book ai didi

objective-c - iphone 5 的 xcode4.2 中的自动引用计数与 __bridge 冲突

转载 作者:搜寻专家 更新时间:2023-10-30 20:22:15 26 4
gpt4 key购买 nike

<分区>

我想创建一个简单的项目来研究在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 a non-Objective-C pointer is disallowed with Automatic Reference Counting

所以我在google上搜索了一下,有 friend 说必须加上宏'__bridge'才能解决,但是不行。

代码:

AudioServicesCreateSystemSoundID( ( __bridge CFURLRef)url, &winSoundID);

错误:

file://localhost/Users/Hikari/Documents/Projects/Pickers/Pickers/CustomPickerViewController.m: error: Semantic Issue: Use of undeclared identifier '__bridge'

自动引用计数已启用! 这个问题怎么解决???

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com