2
votes

I'm trying the following steps to integrate AppLovin for iOS, but an error occurred Do you have any idea how to resolve this issue?

  1. Download AppLovin SDK for iOS and drag AppLovinSDK.framework to my project.
  2. Add dependent frameworks.
    • AdSupport
    • AVFoundation
    • CoreGraphics
    • CoreMedia
    • CoreTelephony
    • StoreKit (NEW)
    • SystemConfiguration
    • UIKit
    • WebKit (OPTIONAL)
  3. Add my AppLoin SDK Key to info.plist.
  4. Add initialize snippets to AppDelegate.m.

    #import <AppLovinSDK/AppLovinSDK.h>
    // ...
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        [ALSdk initializeSdk];
        return YES;
    }
    
  5. Add snippets to display ad to ViewController.m.

    #import <AppLovinSDK/AppLovinSDK.h>
    // ...
    - (void)viewDidLoad {
        [super viewDidLoad];
        if([ALInterstitialAd isReadyForDisplay]){
            [ALInterstitialAd show];
        }
        else{
            NSLog(@"Failed");
        }
    }
    
  6. Run the application and an error occur with the following stacktraces:

    2017-01-03 11:09:58.437 AppLovinSample[80329:1731987] -[NSTaggedPointerString al_containsSubstring:]: unrecognized selector sent to instance 0xa0045564954414e6
    2017-01-03 11:09:58.458 AppLovinSample[80329:1731987] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString al_containsSubstring:]: unrecognized selector sent to instance 0xa0045564954414e6'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x000000010a02c34b __exceptionPreprocess + 171
        1   libobjc.A.dylib                     0x0000000109a8d21e objc_exception_throw + 48
        2   CoreFoundation                      0x000000010a09bf34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
        3   CoreFoundation                      0x0000000109fb1c15 ___forwarding___ + 1013
        4   CoreFoundation                      0x0000000109fb1798 _CF_forwarding_prep_0 + 120
        5   AppLovinSample                      0x0000000106834ac0 -[ALSettingsManager loadFromUserSettings:] + 1295
        6   AppLovinSample                      0x00000001068327f4 -[ALSdk(Private) initWithKey:usingSettings:] + 1446
        7   AppLovinSample                      0x0000000106831799 +[ALSdk sharedWithKey:settings:] + 181
        8   AppLovinSample                      0x00000001068314d7 +[ALSdk shared] + 120
        9   AppLovinSample                      0x000000010683143a +[ALSdk initializeSdk] + 31
        10  AppLovinSample                      0x00000001067fe75c -[AppDelegate application:didFinishLaunchingWithOptions:] + 92
        11  UIKit                               0x0000000106fbb68e -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290
        12  UIKit                               0x0000000106fbd013 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236
        13  UIKit                               0x0000000106fc33b9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
        14  UIKit                               0x0000000106fc0539 -[UIApplication workspaceDidEndTransaction:] + 188
        15  FrontBoardServices                  0x000000011192576b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
        16  FrontBoardServices                  0x00000001119255e4 -[FBSSerialQueue _performNext] + 189
        17  FrontBoardServices                  0x000000011192596d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
        18  CoreFoundation                      0x0000000109fd1311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
        19  CoreFoundation                      0x0000000109fb659c __CFRunLoopDoSources0 + 556
        20  CoreFoundation                      0x0000000109fb5a86 __CFRunLoopRun + 918
        21  CoreFoundation                      0x0000000109fb5494 CFRunLoopRunSpecific + 420
        22  UIKit                               0x0000000106fbedb6 -[UIApplication _run] + 434
        23  UIKit                               0x0000000106fc4f34 UIApplicationMain + 159
        24  AppLovinSample                      0x00000001067fe9ef main + 111
        25  libdyld.dylib                       0x000000010e70a68d start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    

Here is the documentation that how to integrate AppLovin SDK for iOS. (It should be logged in.)

1
Try putting breakpoint and check where exactly crash is happening. - Vishnu gondlekar
It crash at [ALSdk initializeSdk];. According to the stack traces, it looks like [ALSettingsManager loadFromUserSettings:] is the crash point. But I can not find this source code on Internet. - NSR

1 Answers

6
votes

I did not realize some sentence in the official documentation. In order to resolve this issue, I needed to enable Xcode Flags.

Enable Xcode Flags The -ObjC flag must be added for static libraries (such as our SDK) to run correctly.