Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iOS12中找不到ASIdentifierManager_Ios_Objective C_Frameworks_Ios12_Idfa - Fatal编程技术网

在iOS12中找不到ASIdentifierManager

在iOS12中找不到ASIdentifierManager,ios,objective-c,frameworks,ios12,idfa,Ios,Objective C,Frameworks,Ios12,Idfa,我在这里写作,因为我真的被卡住了,找不到答案 我们有一个可以收集IDFA的小框架。 对于IDFA集合,我们首先检查NSClassFromString(@“ASIdentifierManager”) 问题是: 假设我们有一个客户端,这个客户端发布了iOS10-iOS12的版本。 这个客户端为iOS10和iOS11获得IDFA,但对于所有iOS12,根本没有IDFA!检查日志后,我们发现NSClassFromString(@“ASIdentifierManager”)仅在iOS12中为零 客户端如何

我在这里写作,因为我真的被卡住了,找不到答案

我们有一个可以收集IDFA的小框架。 对于IDFA集合,我们首先检查
NSClassFromString(@“ASIdentifierManager”)

问题是:

假设我们有一个客户端,这个客户端发布了iOS10-iOS12的版本。 这个客户端为iOS10和iOS11获得IDFA,但对于所有iOS12,根本没有IDFA!检查日志后,我们发现
NSClassFromString(@“ASIdentifierManager”)
仅在iOS12中为零

客户端如何为iOS10、11添加框架,而不是为iOS12添加框架


另一方面,另一个客户在iOS12方面做得很好。

这可能无法完全回答您的问题,只需将我知道的和我的猜测发短信即可

首先,动态框架将不会加载到您的应用程序进程中,除非您使用它,例如目录下的框架,这些框架可在iOS和模拟器设备中使用

> cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks
> # Now there are plenty of frameworks here.
> file  AdSupport.framework/AdSupport
Mach-O 64-bit dynamically linked shared library x86_64
如何使用它?TLDR,在您的应用程序anywhere中使用
[ASIdentifierManager sharedManager]
调用它,首先链接框架,当然,成功编译它

第二个,直接使用
NSClassFromString()
和在任何地方调用
[ASIdentifierManager sharedManager]
有什么区别

对于前一种情况,您的应用程序不会加载
AdSupport
框架捆绑包,因为在您的可执行程序中没有名为
asiIdentifierManager
的符号。当操作系统内核加载您的程序时,可以通过打印您的应用程序主捆绑包路径并找到应用程序可执行文件来证明这一点,然后尝试
nm|grep“ASIdentifierManager”
,由于您未使用它,因此在结果中找不到任何内容

对于后一个,尝试在可执行程序中grep相同的符号,就是这样

注意:不是操作系统内核通过
nm
结果列表加载框架,而是内核加载包含符号的框架,请查看有关动态加载程序的更多信息

Third
NSClassFromString
仅检查加载的类,如果未加载
AdSupport
框架,则返回nil,而不尝试加载包含目标类的框架

Forth,除非您在项目中粘贴更多关于IDFA和
AdSupport
框架使用的上下文,否则无法回忆iOS 10/11和iOS 12之间的区别。我猜,一些相关库在早期版本中使用
AdSupport
框架,但iOS12,您必须尝试在iOS 11和iOS 12中转储符号列表,并比较结果

Fifth,我不确定您想要什么,可能您试图避免显式导入
AdSupport
框架,如何通过框架路径初始化
NSBundle
,并调用
-(BOOL)加载
NSBundle
类的
,然后可以使用
NSClassFromString
获取
class
对象

更新:


您可能需要为产品增强各种设备的兼容性,有关
NSBundle
用法的更多详细信息,请查看。

您是否尝试过
@import-AdSupport;
或针对project中框架的链接?我们有
\include
。同样的构建适用于iOS10、11。但不适用于iOS12。外观就像客户端不知道怎么排除了iOS12的链接一样-但是howMan,非常感谢你的回答!我真的很感激。你能用
NSBundle
-(BOOL)load
?NSBundle*b=[NSBundle bundleWithPath:@”/System/Library/Frameworks/AdSupport.framework];BOOL success=[b load];更新后,您可能需要增强各种设备对产品的兼容性。
NSString *strFrameworkPath = nil;

#if TARGET_OS_SIMULATOR
strFrameworkPath = [[NSProcessInfo processInfo] environment][@"DYLD_FALLBACK_FRAMEWORK_PATH"];
#else
// Assume that the AdSupport and Foundation framework are in the same directory.
strFrameworkPath = [NSBundle bundleForClass:NSPredicate.class].bundlePath;
strFrameworkPath = [strFrameworkPath stringByDeletingLastPathComponent];
#endif

strFrameworkPath = [strFrameworkPath stringByAppendingPathComponent:@"AdSupport.framework"];
NSAssert([[NSFileManager defaultManager] fileExistsAtPath:strFrameworkPath], @"Invalid framework bundle path!");

NSBundle *bundle = [NSBundle bundleWithPath:strFrameworkPath];

if (!bundle.isLoaded) {
    NSError *error = nil;

    if (![bundle loadAndReturnError:&error]) {
        DDLogError(@"Load framework bundle %@ with error %@", bundle, error);
    }
}

DDLogDebug(@"bundle: %@", bundle.bundlePath);
DDLogDebug(@"class: %@", NSClassFromString(@"ASIdentifierManager"));