iAd Code in WWDC Session 503 does not work

Recommendation is as follows for AppDelegate.swift:


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

UIViewController.prepareInterstitialAds()

return true


Exception is:


2015-08-16 10:51:54.555 troubleiAd[46052:7032519] +[UIViewController prepareInterstitialAds]: unrecognized selector sent to class 0x10e478870

2015-08-16 10:51:54.558 troubleiAd[46052:7032519] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIViewController prepareInterstitialAds]: unrecognized selector sent to class 0x10e478870'

*** First throw call stack:

(

0 CoreFoundation 0x000000010cc239b5 __exceptionPreprocess + 165

1 libobjc.A.dylib 0x000000010ec16deb objc_exception_throw + 48

2 CoreFoundation 0x000000010cc2bedd +[NSObject(NSObject) doesNotRecognizeSelector:] + 205

3 CoreFoundation 0x000000010cb799fa ___forwarding___ + 970

4 CoreFoundation 0x000000010cb795a8 _CF_forwarding_prep_0 + 120

5 troubleiAd 0x000000010ca3cf04 _TFC10troubleiAd11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 100

6 troubleiAd 0x000000010ca3d023 _TToFC10troubleiAd11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 179


change uiviewcontroller to GameViewContoller:


2015-08-16 11:02:08.100 troubleiAd[46190:7052666] +[troubleiAd.GameViewController prepareInterstitialAds]: unrecognized selector sent to class 0x1035aa5f0

2015-08-16 11:02:08.103 troubleiAd[46190:7052666] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[troubleiAd.GameViewController prepareInterstitialAds]: unrecognized selector sent to class 0x1035aa5f0'

*** First throw call stack:

(

0 CoreFoundation 0x000000010378b9b5 __exceptionPreprocess + 165

1 libobjc.A.dylib 0x000000010577edeb objc_exception_throw + 48

2 CoreFoundation 0x0000000103793edd +[NSObject(NSObject) doesNotRecognizeSelector:] + 205

3 CoreFoundation 0x00000001036e19fa ___forwarding___ + 970

4 CoreFoundation 0x00000001036e15a8 _CF_forwarding_prep_0 + 120

5 troubleiAd 0x00000001035a4f54 _TFC10troubleiAd11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 100

6 troubleiAd 0x00000001035a5073 _TToFC10troubleiAd11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 179


Please help

iAd Code in WWDC Session 503 does not work
 
 
Q