问题1:ADClient编译报错问题
报错信息
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_ADClient", referenced from:
in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
相关代码(demo)
原因
苹果对AdClicent API加了一个标识
ADCLIENT_DEPRECATED_IOS_90_145_OBSOLETED_180
表示:iOS7.1-iOS14.5可用,iOS18彻底废弃,会在iOS18系统上编译失败。
解决办法
使用AdService库的AAAttribution替代,注意iOS14.3才可以使用。
代码
if (@available(ios 14.3, *)) {
NSError *error;
NSString *token = [AAAttribution attributionTokenWithError:&error];
if (token != nil) {
...
}
}
参考
https://developer.apple.com/forums/thread/759156
https://developer.apple.com/documentation/iad?language=objc
问题2:Xcode16(正式版)运行时,YYCache导致crash
报错信息
原因
在 iOS18 中,需要提前对 sqlite3_stmt 执行 sqlite3_finalize。