question

p-robi86 avatar image
p-robi86 asked

AmazonAdRegistration crashes when calling setAppKey

Hi,

My application crashes when I try to set the appKey for the AmazonAdRegistration class.

My code:

AmazonAdRegistration.sharedRegistration().setAppKey("123")

The other methods on the AmazonAdRegistration class work fine. For eg: the following lines do work:

print("Amazon version: \(AmazonAdRegistration.sharedRegistration().sdkVersion())")

AmazonAdRegistration.sharedRegistration().setLogging(true)

The logs show that the app crashes somewhere at a class called AMAdConfiguration.

Crash details below:

2016-06-22 16:32:03.193 BreathePlus[11186:2674778] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString URLEncodedString]: unrecognized selector sent to instance 0x107704f88'

*** First throw call stack:

(

0 CoreFoundation 0x000000010acfdd85 __exceptionPreprocess + 165

1 libobjc.A.dylib 0x000000010a011deb objc_exception_throw + 48

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

3 CoreFoundation 0x000000010ac4ccfa ___forwarding___ + 970

4 CoreFoundation 0x000000010ac4c8a8 _CF_forwarding_prep_0 + 120

5 BreathePlus 0x0000000107518617 -[AMAdConfiguration setApplicationId:applicationName:userSpecifiedMarketplace:] + 85

6 BreathePlus 0x000000010752256d -[AmazonAdRegistration setAppKey:] + 93

7 BreathePlus 0x00000001074e7161 _TFFC11BreathePlus11AppDelegate11applicationFTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryCSo8NSObjectPs9AnyObject____SbU_FT_T_ + 1041

8 BreathePlus 0x00000001074b1717 _TTRXFo__dT__XFdCb__dT__ + 39

9 libdispatch.dylib 0x000000011033dd9d _dispatch_call_block_and_release + 12

10 libdispatch.dylib 0x000000011035e3eb _dispatch_client_callout + 8

11 libdispatch.dylib 0x0000000110343686 _dispatch_after_timer_callback + 334

12 libdispatch.dylib 0x000000011035e3eb _dispatch_client_callout + 8

13 libdispatch.dylib 0x00000001103517e5 _dispatch_source_latch_and_call + 1750

14 libdispatch.dylib 0x000000011034c770 _dispatch_source_invoke + 1057

15 libdispatch.dylib 0x0000000110346051 _dispatch_main_queue_callback_4CF + 1324

16 CoreFoundation 0x000000010ac570f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9

17 CoreFoundation 0x000000010ac18b99 __CFRunLoopRun + 2073

18 CoreFoundation 0x000000010ac180f8 CFRunLoopRunSpecific + 488

19 GraphicsServices 0x000000010d989ad2 GSEventRunModal + 161

20 UIKit 0x00000001079edf09 UIApplicationMain + 171

21 BreathePlus 0x00000001074e6bb2 main + 114

22 libdyld.dylib 0x000000011039292d start + 1

23 ??? 0x0000000000000001 0x0 + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

mobile adsios
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Levon@Amazon avatar image
Levon@Amazon answered

Hi there,

Thanks for posting. To resolve this issue, please add the -ObjC linker flag: https://developer.apple.com/library/mac/qa/qa1490/_index.html

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.