优艾设计网

clang编译objective-c失败 财富值45?

#import <UIKit/UIKit.h> #import "AppDelegate.h" #import "Person.h"extern void _objc_autoreleasePoolPrint();int main(int argc, char * argv[]) { @autoreleasepool { Person *p = [Person new]; Person __weak *p2 = p; NSLog(@"%@", p2); _objc_autoreleasePoolPrint(); //return UIApplicationMai优艾设计网_PS问答n(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }

结果是这样的:

$ clang -rewrite-objc -fobjc-arc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk main.m /var/folders/t0/nty3j9vx1rn8786q_tpclydc0000gn/T/main-2fe2fd.mi:46509:31: error: cannot create __weak reference because the current deployment target does not support weak references Person __attribute__((objc_ownership(weak))) *p2 = p; ^ 1 error generated.

求解答


1090295577b 2022-09-19 09:39

优艾设计网_PS百科

__Weak不是应该在类名前面吗?


0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜