AppLovin / AppLovin-MAX-SDK-iOS

86 stars 70 forks source link

Xcode 14 applovin bytedance crash the app #193

Open jesphinpt opened 1 year ago

jesphinpt commented 1 year ago

MAX SDK Version

11.5.5

Device/Platform Info

ios

Current Behavior

App crash on xcode 14 with bytedance sdk.

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'

Screenshot 2023-02-02 at 6 53 17 PM

Expected Behavior

App needs not to be crash on the xcode 14.

How to Reproduce

Add bytedance adapter in xcode 14, app is crashing with ios 16.2.

Additional Info

No response

thomasmso commented 1 year ago

Could you provide the full stack trace?

jesphinpt commented 1 year ago

Error log:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007ff8004288ab __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007ff80004dba3 objc_exception_throw + 48
    2   CoreFoundation                      0x00007ff8004b0019 -[__NSCFString characterAtIndex:].cold.1 + 0
    3   CoreFoundation                      0x00007ff8004ba7d0 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
    4   CoreFoundation                      0x00007ff80049b243 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 251
    5   CoreFoundation                      0x00007ff8004274dd +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
    6   Project                            0x000000010e32dcba -[ALCommunicatorService sendUpdatedNetworkSDKVersion:adapterClass:] + 141
    7   Project                            0x000000010e397f60 -[ALDMediatedNetwork didReceiveMessage:] + 695
    8   Project                            0x000000010e48d432 -[ALCSubscription handleMessageReceived:] + 444
    9   CoreFoundation                      0x00007ff80035964b __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 137
    10  CoreFoundation                      0x00007ff800359581 ___CFXRegistrationPost_block_invoke + 86
    11  CoreFoundation                      0x00007ff800358b60 _CFXRegistrationPost + 541
    12  CoreFoundation                      0x00007ff800358469 _CFXNotificationPost + 822
    13  Project                            0x000000010e41ed86 __38-[ALCMessagingService publishMessage:]_block_invoke + 65
    14  libdispatch.dylib                   0x0000000114c4fd18 _dispatch_call_block_and_release + 12
    15  libdispatch.dylib                   0x0000000114c50f5b _dispatch_client_callout + 8
    16  libdispatch.dylib                   0x0000000114c66118 _dispatch_root_queue_drain + 1087
    17  libdispatch.dylib                   0x0000000114c66b17 _dispatch_worker_thread2 + 278
    18  libsystem_pthread.dylib             0x00007ff836170f8a _pthread_wqthread + 256
    19  libsystem_pthread.dylib             0x00007ff83616ff57 start_wqthread + 15
)
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
CoreSimulator 857.14 - Device: iPhone 14 (B60BA184-8664-4BBF-9316-8A1A8885CD56) - Runtime: iOS 16.2 (20C52) - DeviceType: iPhone 14
(lldb) 
thomasmso commented 1 year ago

Interesting. The only way that could occur is if their SDK is returning nil for their SDK version.

How are you integrating the adapter? Via source code? Have you modified the code?

thomasmso commented 1 year ago

Could you also enable and send over our SDK's verbose logs while reproducing the issue?

jesphinpt commented 1 year ago

@thomasmso I have downloaded the SDK using the manual download and added it to our code. But this is failing in Xcode 14.

thomasmso commented 1 year ago

I'm pretty sure you're not linking their SDKs correctly, if you can reproduce it in the demo app in this repo and send that over, we can better help you diagnose.

jesphinpt commented 1 year ago

@thomasmso I will give the reproducible steps:

  1. Download the ByteDance adapter from the Applovin Manual download link
  2. Add this to link binaries section of Xcode.
  3. Download the pangle zip from the pangle platform
  4. Add the downloaded SDK to the project and link the frameworks and the bundle.
  5. Add the dependent libraries available over here
  6. Then run the app
  7. It will show a crash with the app.
thomasmso commented 1 year ago

@jesphinpt -

Our adapter is certified against Ads-Global/BUAdSDK_Compatible v4.8.1.0 and Ads-CN/BUAdSDK_Compatible v4.9.0.7. (Podspec here).

Thus, you need to download their SDK from these two locations:

https://github.com/CocoaPods/Specs/blob/master/Specs/d/9/8/Ads-CN/4.9.0.7/Ads-CN.podspec.json#L15 https://github.com/CocoaPods/Specs/blob/master/Specs/d/1/c/Ads-Global/4.8.1.0/Ads-Global.podspec.json#L15

And it should work.

jesphinpt commented 1 year ago

I have attached the verbose message and the steps below

Steps:

  1. Download the Pangle.zip and unzip the file
  2. Then add the frameworks to the project and linked with the Binaries
  3. Added the dependent libraries available on the Pangle integration framework.
  4. Then download the ApplovinMediationByteDanceAdapter.xcframework
  5. Added the SKAdNetworkIdentifier.

Note: In apple chip machine with Xcode 13.2.1 it works, but the same not works in the Dual-Core Intel Core i5 machine with xcode version 13.4.1, 13.2.1 and 14.2 versions.

If I remove the ByteDanceMediationAdapter, it will show the below debugger screen as missing adapter message without any crashes. Kindly refer below

Logs which I have taken from the mac mini 13.4.1 and 14:

`[ALCommunicatorService] Sending "safedk_init" message: { "applovin_random_token" = "529c1307-62cc8"; "compass_random_token" = "f32f4a2a6"; "device_type" = phone; "init_success" = 1; "installed_mediation_adapters" = ( { class = ALAppLovinMediationAdapter; name = AppLovin; "sdk_version" = "11.7.1"; version = "11.7.1"; }, { class = ALByteDanceMediationAdapter; name = Pangle; "sdk_version" = "sdk_version"; version = "4.8.1.0.2"; }, { class = ALFacebookMediationAdapter; name = Facebook; "sdk_version" = "6.12.0"; version = "6.12.0.1"; }, { class = ALGoogleMediationAdapter; name = AdMob; "sdk_version" = "afma-sdk-i-v9.8.0"; version = "9.14.0.2"; }, { class = ALMintegralMediationAdapter; name = Mintegral; "sdk_version" = "7.2.9"; version = "7.2.9.0.1"; }, { class = ALVungleMediationAdapter; name = Vungle; "sdk_version" = "6.12.1"; version = "6.12.1.2"; } ); "sdk_key" = "value"; }

2023-02-04 15:03:21.691972+0530 Project[1200:20160] [AppLovinSdk] DEBUG [ALMediationAdapterWrapper] ALByteDanceMediationAdapter: running initialize... 2023-02-04 15:03:21.768171+0530 Project[1200:20160] [AppLovinSdk] INFO [ALByteDanceMediationAdapter] ByteDance SDK failed to initialize with error: Error Domain=com.buadsdk Code=98765 "initialization failed" UserInfo={NSLocalizedDescription=initialization failed} 2023-02-04 15:03:21.768592+0530 Project[1200:20160] [AppLovinSdk] DEBUG [ALMediationAdapterWrapper] ALByteDanceMediationAdapter: finished initialize 023-02-04 15:03:21.770925+0530 Project[1200:20160] [AppLovinSdk] DEBUG [ALMediationAdapterWrapper] ALByteDanceMediationAdapter: running initialize... 2023-02-04 15:03:21.771099+0530 Project[1200:20160] [AppLovinSdk] INFO [ALByteDanceMediationAdapter] ByteDance SDK already initialized 2023-02-04 15:03:21.771290+0530 Project[1200:20160] [AppLovinSdk] DEBUG [ALMediationAdapterWrapper] ALByteDanceMediationAdapter: finished initialize`

Screenshot 2023-02-04 at 4 13 41 PM
jesphinpt commented 1 year ago

Our adapter is certified against Ads-Global/BUAdSDK_Compatible v4.8.1.0 and Ads-CN/BUAdSDK_Compatible v4.9.0.7. (Podspec here).

Thus, you need to download their SDK from these two locations:

https://github.com/CocoaPods/Specs/blob/master/Specs/d/9/8/Ads-CN/4.9.0.7/Ads-CN.podspec.json#L15 https://github.com/CocoaPods/Specs/blob/master/Specs/d/1/c/Ads-Global/4.8.1.0/Ads-Global.podspec.json#L15

And it should work.

It fails with numerous errors

Steps:

  1. Unzip the file and added the frameworks manually
  2. Linked the lib files as mentioned in the podspec
  3. Add adapter
  4. Then run the app
  5. Failed with below errors
Showing All Errors Only
Undefined symbol: _OBJC_METACLASS_$_PAGWKWebView
Undefined symbol: _OBJC_CLASS_$_PAG_AFXMLParserResponseSerializer
Undefined symbol: _OBJC_CLASS_$_PAG_ZFPlayerControlView
Undefined symbol: _OBJC_CLASS_$_PAGReachability
Undefined symbol: _OBJC_CLASS_$_PAGJSBForwarding
Undefined symbol: _OBJC_CLASS_$_PAG_SDWeakProxy
Undefined symbol: _OBJC_CLASS_$_PAG_SDImageCacheConfig
Undefined symbol: _OBJC_CLASS_$_PAGGifImage
Undefined symbol: _OBJC_CLASS_$_PAGScreenHelper
Undefined symbol: _OBJC_CLASS_$_PAG_SDWebImageDownloader
Undefined symbol: _OBJC_CLASS_$_PAGPlayerItem
Undefined symbol: _OBJC_METACLASS_$_PAGNetworkRequest
Undefined symbol: _OBJC_CLASS_$_PAGDownloadSpeedServer
Undefined symbol: _OBJC_CLASS_$_PAG_AFHTTPSessionManager
Undefined symbol: _OBJC_CLASS_$_BUAppOpenA
Undefined symbol: _OBJC_CLASS_$_PAGDeviceHelper
Undefined symbol: _PAG_JSONObjectByRemovingKeysWithNullValues
Undefined symbol: _OBJC_CLASS_$_PAGEnvironment
Undefined symbol: _PAG_LOG_ENABLED
Undefined symbol: _pag_safe_dispatch_sync_main_queue
Undefined symbol: _OBJC_CLASS_$_PAGGeckoPreloadManager
Undefined symbol: _pag_portraitAdSafeInsets
Undefined symbol: _OBJC_CLASS_$_PAGTNCServiceManager
Undefined symbol: _OBJC_CLASS_$_PAGDynamicPlugin
Undefined symbol: _OBJC_CLASS_$_PAGQueueManage
Undefined symbol: _OBJC_CLASS_$_PAGTNCRequestParam
Undefined symbol: _kPAGReachabilityChangedNotificatio
Undefined symbol: _OBJC_CLASS_$_PAGRouter
Undefined symbol: _OBJC_CLASS_$_PAGWebImageDataCacheManager
Undefined symbol: _OBJC_CLASS_$_PAGPersistence
Undefined symbol: _pag_is_notch_screen
Undefined symbol: _OBJC_CLASS_$_PAGAudioSessionHandler
Undefined symbol: _OBJC_CLASS_$_PAGVideoPrefetchManager
Undefined symbol: _OBJC_METACLASS_$_PAGDynamicPlugin
Undefined symbol: _OBJC_CLASS_$_PAGGifImageView
Undefined symbol: _OBJC_CLASS_$_PAGThreadSafeDictionary
Undefined symbol: _OBJC_CLASS_$_BURewardedVideoModel
Undefined symbol: _OBJC_CLASS_$_PAGLogManager
Undefined symbol: _OBJC_CLASS_$_PAGConditionTracker
Undefined symbol: _OBJC_CLASS_$_PAG_SDImageCache
Undefined symbol: _OBJC_CLASS_$_PAGPlayer
Undefined symbol: _OBJC_CLASS_$_PAG_SDWebImageManager
Undefined symbol: _OBJC_CLASS_$_PAGCacheManager
Undefined symbol: _PAGSDKRelyVersion
Undefined symbol: _OBJC_CLASS_$_BUNativeExpressBannerView
Undefined symbol: _OBJC_CLASS_$_PAGUserAgentHelper
Undefined symbol: _pag_safe_dispatch_async_main_queue
Undefined symbol: _OBJC_CLASS_$_PAGAudioSessionSetting
Undefined symbol: _OBJC_CLASS_$_PAGPersistenceOption
Undefined symbol: _OBJC_CLASS_$_PAGNetworkAgent
Undefined symbol: _NSStringFromPAGAdEnumItem
Undefined symbol: _OBJC_CLASS_$_BUNativeAdRelatedView
Undefined symbol: _OBJC_CLASS_$_BURewardedVideoA
Undefined symbol: _PAGDefaultTelephonyNetworkInf
Undefined symbol: _OBJC_CLASS_$_BUFullscreenVideoAd
Undefined symbol: _OBJC_CLASS_$_PAG_ZipArchiveUtility
Undefined symbol: _OBJC_CLASS_$_BUAdSlot
Undefined symbol: _OBJC_CLASS_$_PAGNetworkRequest
Undefined symbol: _OBJC_CLASS_$_PAGWebViewProgressView
Undefined symbol: _OBJC_CLASS_$_PAGTimer
Undefined symbol: _OBJC_CLASS_$_PAG_SDWebImagePrefetcher
Undefined symbol: _OBJC_CLASS_$_BUAdSDKManager
Undefined symbol: _OBJC_CLASS_$_BUAdSDKConfiguration
Undefined symbol: _OBJC_CLASS_$_BUSize
Undefined symbol: _OBJC_CLASS_$_PAGWKWebView
Undefined symbol: _OBJC_CLASS_$_BUSplashAd
Undefined symbol: _OBJC_CLASS_$_BUNativeAdsManager
Undefined symbol: _OBJC_CLASS_$_PAGThreadSafeMutableArray
Undefined symbol: _NSStringLogFromPAGAdEnumItem
thomasmso commented 1 year ago

Could you send me the project reproducing the issue? Or reproduce it with this demo app and send that over?

jesphinpt commented 1 year ago

Steps to reproduce the above:

  1. Download the zip and add to the Link binaries of Xcode.
  2. Download the zip and add it to the Link binaries of Xcode
  3. Add the respective libs to the Link binaries file as mentioned here and here
  4. Add the respective libs to the Link binaries files as mentioned here as well
  5. Run the app. It produce the above errors.

Note: Unable to push the above change in the demo app for me , because of the exceeds size limit issue.

Lorenzo45 commented 1 year ago

Hi @jesphinpt - looks like there are additional dependencies of the ByteDance SDKs listed here and here. That's probably where the missing frameworks can be found.

I would recommend using Cocoapods to install the adapter. If you must integrate manually, you can follow the instructions here (there might be separate instructions for the CSJ SDK): https://www.pangleglobal.com/integration/integrate-pangle-sdk-for-ios#1ka7j1q854ww0

If you experience further issues I would recommend reaching out to ByteDance support

jesphinpt commented 1 year ago

@Lorenzo45 I have tried the sdk which you have mentioned, it not working on the mac mini intel processor. Working on apple chip. Here the failure happens after adding the mediation adapter.

I will give the reproducible steps:

  1. Download the ByteDance adapter from the Applovin Manual download link
  2. Add this to link binaries section of Xcode.
  3. Download the pangle zip from the pangle platform
  4. Add the downloaded SDK to the project and link the frameworks and the bundle.
  5. Add the dependent libraries available over here
  6. Then run the app
  7. It will show a crash with the app.
Lorenzo45 commented 1 year ago

Did you follow all the instructions here? https://www.pangleglobal.com/integration/integrate-pangle-sdk-for-ios#1ka7j1q854ww0

jesphinpt commented 1 year ago

Yes, it works in apple chip machine and fails in intel core machine. Like the below

I have attached the verbose message and the steps below

Steps:

  1. Download the Pangle.zip and unzip the file
  2. Then add the frameworks to the project and linked with the Binaries
  3. Added the dependent libraries available on the Pangle integration framework.
  4. Then download the ApplovinMediationByteDanceAdapter.xcframework
  5. Added the SKAdNetworkIdentifier.

Note: In apple chip machine with Xcode 13.2.1 it works, but the same not works in the Dual-Core Intel Core i5 machine with xcode version 13.4.1, 13.2.1 and 14.2 versions.

If I remove the ByteDanceMediationAdapter, it will show the below debugger screen as missing adapter message without any crashes. Kindly refer below

Logs which I have taken from the mac mini 13.4.1 and 14:

Lorenzo45 commented 1 year ago

Ok thanks for the information. Could you send us the full Xcode project/workspace? That will allow us to debug the issue more effectively. You can upload the zipped project to a cloud storage service like Google Drive or Dropbox.