Use of undeclared identifier: ASIdentifierManager
Asked Answered
R

2

21

I am using the following code to show the unique identifier to be used for admob test apps.

This is with my applicationDidFinishLaunching...

// Print IDFA (from AdSupport Framework) for iOS 6 and UDID for iOS < 6.
if (NSClassFromString(@"ASIdentifierManager")) {
    NSLog(@"GoogleAdMobAdsSDK ID for testing: %@" ,
          [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]);
} else {
    NSLog(@"GoogleAdMobAdsSDK ID for testing: %@" ,
          [[UIDevice currentDevice] uniqueIdentifier]);
}

I get an error when building 'Use of undeclared identifier: ASIdentifierManager'

I have the AdSupport framework linked and can access the files the identifier manager is declared in, but it still doesn't recognise that?

I have cleaned build folder, restarted xCode same result.

Recliner answered 9/1, 2013 at 22:25 Comment(5)
Which line specifically are you getting the error in?Ramtil
[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]);Recliner
Have you imported headers from the framework?Kuth
#import <AdSupport/ASIdentifierManager.h>Kuth
No I hadn't as I assumed by them being in the 'Link Binary With Libraries' I didn't need to? Please submit as an answer it resolves the issueRecliner
K
55

Have you imported headers from the framework?

#import <AdSupport/ASIdentifierManager.h>
Kuth answered 10/1, 2013 at 8:5 Comment(0)
D
0

Thanks for your answer! if it is a framework add the beginning path. The example that repaired my error was:

#import "CoreMotion/CMMotionActivityManager.h"

I was incorrect as I only added the .h file.

#import "CMMotionActivityManger.h"  ---  This was incorrect and generated an error.
Deaf answered 16/6, 2014 at 1:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.