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.

StuartM
  • 6,743
  • 18
  • 84
  • 160

2 Answers2

55

Have you imported headers from the framework?

#import <AdSupport/ASIdentifierManager.h>
Shmidt
  • 16,436
  • 18
  • 88
  • 136
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.
David Ansermot
  • 6,052
  • 8
  • 47
  • 82
Chip Russell
  • 65
  • 10