I am testing AppTrackingTransparency - https://developer.apple.com/documentation/apptrackingtransparency framework. I was able to get a valid IDFA on an iOS 14 simulator by following steps in the doc.
When I turned off "Settings > Privacy > Apple Advertising > Personalized Ads", the IDFA became 0s, which is expected. However, after I turned "Personalized Ads" back on, I still got zeroed-out IDFA.
I tried several ways to reset the simulator, e.g. Device > Erase All Content and Settings…, but I cannot get it back to a working state. I cannot get a valid IDFA anymore.
Environment:
Xcode 12.0 beta (12A6159)
macOS Catalina 10.15.5
Post
Replies
Boosts
Views
Activity
Is there any threading assumption/requirement for ASIdentifierManager.advertisingIdentifier?
Please see the complete issue and stack trace here. The main thread was waiting for the worker thread, which was blocked in ASIdentifierManager.advertisingIdentifier.
Thread 68:
0 libsystem_kernel.dylib 0x188abf0f4 mach_msg_trap (in libsystem_kernel.dylib) + 8
1 libsystem_kernel.dylib 0x188abe5a0 mach_msg (in libsystem_kernel.dylib) + 72
2 libdispatch.dylib 0x188924880 _dispatch_mach_send_and_wait_for_reply (in libdispatch.dylib) + 500
3 libdispatch.dylib 0x188924d10 dispatch_mach_send_with_result_and_wait_for_reply$VARIANT$mp (in libdispatch.dylib) + 52
4 libxpc.dylib 0x188b8391c xpc_connection_send_message_with_reply_sync (in libxpc.dylib) + 204
5 Foundation 0x189aafa28 NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY (in Foundation) + 12
6 Foundation 0x189892f60 -[NSXPCConnection sendInvocation:orArguments:count:methodSignature:selector:withProxy:] (in Foundation) + 3608
7 CoreFoundation 0x188f3276c forwarding (in CoreFoundation) + 552
8 CoreFoundation 0x188f3475c forwarding_prep_0 (in CoreFoundation) + 92
9 CoreServices 0x1b1896ce4 -[LSApplicationWorkspace deviceIdentifierForAdvertising] (in CoreServices) + 160
10 AdSupport 0x198f70a60 -[ASIdentifierManager advertisingIdentifier] (in AdSupport) + 56
I don't see any thread related information in the document. I tried to recreate the scenario, but I could not reproduce the issue with the simplified test below.
#import "ViewController.h"
#import "AdSupport/AdSupport.h"
#import "AppTrackingTransparency/AppTrackingTransparency.h"
@interface ViewController () {
dispatch_queue_t _queue;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_queue = dispatch_queue_create("IdentityWorkerQueue", DISPATCH_QUEUE_SERIAL);
dispatch_set_target_queue(_queue,
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0));
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:
^(ATTrackingManagerAuthorizationStatus status) {
NSLog(@"Status: %lu", (unsigned long)status);
}];
}
}
- (IBAction)action:(id)sender {
__block NSString *adId1 = nil;
dispatch_async(self->_queue, ^{
sleep(1);
adId1 = ASIdentifierManager.sharedManager.advertisingIdentifier.UUIDString;
});
__block NSString *adId2 = nil;
dispatch_sync(self->_queue, ^{
adId2 = adId1;
});
}
@end
Is there any threading assumption/requirement for ASIdentifierManager.advertisingIdentifier? For example, would it wait for the main thread to finish a certain task when an error happens?
According to About the App Launch Sequence, application:didFinishLaunchingWithOptions: won't be called during app prewarming on iOS 15. The Objective-C app works as documented.
However, the Swift app behaves differently. application(_:didFinishLaunchingWithOptions:) is called during app prewarming.
I believe this mismatch is an unintentional bug, and it brings a few issues. I can still observe this issue on iOS 15.2. Is there a plan to fix this bug?