Search Unity

Resolved Mediation fails to initialize on iOS with an exception

Discussion in 'Unity Mediation' started by amjaliks, Apr 12, 2022.

  1. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    Just integrated Mediation SDK in our project. It works fine in Editor. Runs on Android. However, fails with an exception on iOS:

    NSInvalidArgumentException: +[UMISConfigurationResponse adNetworkFromAdNetworkName:]: unrecognized selector sent to class


    2022-04-12 02:41:27.289287+0300 PrimePeaks[24141:5332209] UnityMediationSdk with version 0.4.1 in use
    2022-04-12 02:41:27.292392+0300 PrimePeaks[24141:5332209] UMSReachability Flag Status: -R ------- networkStatusForFlags
    2022-04-12 02:41:27.693649+0300 PrimePeaks[24141:5332596] Attribution returned an error: Error Domain=ADClientErrorDomain Code=1 "The app is not authorized for ad tracking" UserInfo={NSLocalizedDescription=The app is not authorized for ad tracking}
    2022-04-12 02:41:27.718147+0300 PrimePeaks[24141:5332531] Unity Mediation diagnostics are Enabled
    2022-04-12 02:41:27.742884+0300 PrimePeaks[24141:5332531] Uncaught exception: NSInvalidArgumentException: +[UMISConfigurationResponse adNetworkFromAdNetworkName:]: unrecognized selector sent to class 0x10bd57e48
    (
    0 CoreFoundation 0x0000000181859110 E2F84645-2905-31EF-8EC7-3CC19C3CDDB3 + 626960
    1 libobjc.A.dylib 0x000000019a0a9d64 objc_exception_throw + 60
    2 CoreFoundation 0x0000000181935ff4 E2F84645-2905-31EF-8EC7-3CC19C3CDDB3 + 1531892
    3 CoreFoundation 0x00000001817ee524 E2F84645-2905-31EF-8EC7-3CC19C3CDDB3 + 189732
    4 CoreFoundation 0x00000001817ed660 _CF_forwarding_prep_0 + 96
    5 UnityFramework 0x000000010a83d0d8 -[UMSAdNetworkInitializationAdapterFactory getAdapterWithAdapterClass:] + 80
    6 UnityFramework 0x000000010a83abf4 -[UMSAdNetworkAdapterInitializationService initAdapter:installationId:adapterClass:] + 348
    7 UnityFramework 0x000000010a83a7b0 -[UMSAdNetworkAdapterInitializationService initializeAdNetworkAdaptersWithGameId:installationId:adapterClasses:] + 216
    8 UnityFramework 0x000000010a846c38 -[UMSInitializeRun initializeAdapters] + 480
    9 UnityFramework 0x000000010a846758 -[UMSInitializeRun initializationResponseHandlerWithResponse:error:] + 160
    10 UnityFramework 0x000000010a846628 __32-[UMSInitializeRun initializing]_block_invoke.47 + 60
    11 libdispatch.dylib 0x00000001814c9924 BD02A625-8475-3FD6-8DC3-8AED25D1573B + 10532
    12 libdispatch.dylib 0x00000001814cb670 BD02A625-8475-3FD6-8DC3-8AED25D1573B + 18032
    13 libdispatch.dylib 0x00000001814ce798 BD02A625-8475-3FD6-8DC3-8AED25D1573B + 30616
    14 libdispatch.dylib 0x00000001814dcde0 BD02A625-8475-3FD6-8DC3-8AED25D1573B + 89568
    15 libdispatch.dylib 0x00000001814dd608 BD02A625-8475-3FD6-8DC3-8AED25D1573B + 91656
    16 libsystem_pthread.dylib 0x00000001f22e70b8 _pthread_wqthread + 228
    17 libsystem_pthread.dylib 0x00000001f22e6e94 start_wqthread + 8
    )

    Unity 2020.3.33f1 (I have also tried .32f1)
    SDK 0.4.1 (tried 0.4.0 too)
    Xcode 13.3
     
  2. DeclanMcPartlin

    DeclanMcPartlin

    Unity Technologies

    Joined:
    Nov 19, 2020
    Posts:
    146
    Hi @amjaliks,

    Thanks for reaching out. Could you also share your Podfile and Podfile.lock from your generated iOS project?

    Thank you,
     
  3. DeclanMcPartlin

    DeclanMcPartlin

    Unity Technologies

    Joined:
    Nov 19, 2020
    Posts:
    146
    After a quick go at trying to reproduce your issue, I was quickly able to reproduce your issue. The most possible reason that this is occurring is because your target in Xcode doesn't have the '-ObjC' flag in the 'Other Linker Flags' section. In most cases that would be the UnityFramework target, and by default it should be there.

    My question to you is, are you changing the xcodeproj file via script post build by any chance? Or is there any way you know of that would be changing the values of 'Other Linker Flags' ?
     
  4. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    Thanks! Indeed UnityFramework is missing the
    -ObjC
    flag.

    Unfortunately, I can't find why this flag is missing from our iOS builds.

    From my attempts to understand what is going, this isn't related to .pbxproj modifications. This flag should come from .xcconfig file created by CocoaPods. At least this how works when I create a new empty Unity project and add Mediation package to it.
     
  5. DeclanMcPartlin

    DeclanMcPartlin

    Unity Technologies

    Joined:
    Nov 19, 2020
    Posts:
    146
    Thanks for providing further insight into this. Generally it is Cocoapods that includes that flag into UnityFrameworks, right. Which version of Cocoapods are you using? If possible, let us know if you find out what is causing this scenario in your project if you get to the bottom of it, I'll let you know if we are able to reproduce. Also, if you could share the Podfile of the generated Xcode project, that could help pinpoint the issue.

    Thanks!
     
  6. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    The issue went away after adding an AppLovin adapter, as its podspec includes
    -ObjC
    definition.
    Maybe the same should be done with a podspec for Unity Mediation SDK?
     
  7. DeclanMcPartlin

    DeclanMcPartlin

    Unity Technologies

    Joined:
    Nov 19, 2020
    Posts:
    146
    Hi @amjaliks,

    This is a known issue on certain Cocoapod versions, for example versions below 1.10.1. If you in fact do have such an older version, let us know if upgrading your Cocoapods version fixes the issue.

    Thanks for sharing this issue with us!
     
  8. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    Yes, indeed I have used and older version of CocoaPods 1.9.1.
    Updating to 1.11.3 seams to resolved the issue.

    I haven't done complete testing, however, a quick build of a Unity projects results in an Xcode project that has
    -ObjC
    flag set.
     
  9. DeclanMcPartlin

    DeclanMcPartlin

    Unity Technologies

    Joined:
    Nov 19, 2020
    Posts:
    146
    Thank you for confirm this with us @amjaliks, much appreciated.
     
  10. prabakar_cmgames_in

    prabakar_cmgames_in

    Joined:
    Dec 8, 2022
    Posts:
    1
    2023-10-14 14:40:12.810219+0530 CricketGangsta[1125:316661] UnityIAP UnityEarlyTransactionObserver: Created

    2023-10-14 14:40:12.811338+0530 CricketGangsta[1125:316661] UnityIAP UnityEarlyTransactionObserver: Registered for lifecycle events

    2023-10-14 14:40:12.856890+0530 CricketGangsta[1125:316661] FCM: Loading UIApplication FIRFCM category

    2023-10-14 14:40:13.135542+0530 CricketGangsta[1125:316661] Loading UIApplication category for Firebase App

    2023-10-14 14:40:13.443399+0530 CricketGangsta[1125:316897] 9.3.0 - [FirebaseCore][I-COR000005] No app has been configured yet.

    CrashReporter: initialized

    2023-10-14 14:40:13.913310+0530 CricketGangsta[1125:316661] Built from '2021.3/staging' branch, Version '2021.3.8f1 (b30333d56e81)', Build type 'Release', Scripting Backend 'il2cpp'

    2023-10-14 14:40:13.914539+0530 CricketGangsta[1125:316661] MemoryManager: Using 'Default' Allocator.

    [UnityMemory] Configuration Parameters - Can be set up in boot.config

    "memorysetup-bucket-allocator-granularity=16"

    "memorysetup-bucket-allocator-bucket-count=8"

    "memorysetup-bucket-allocator-block-size=4194304"

    "memorysetup-bucket-allocator-block-count=1"

    "memorysetup-main-allocator-block-size=16777216"

    "memorysetup-thread-allocator-block-size=16777216"

    "memorysetup-gfx-main-allocator-block-size=16777216"

    "memorysetup-gfx-thread-allocator-block-size=16777216"

    "memorysetup-cache-allocator-block-size=4194304"

    "memorysetup-typetree-allocator-block-size=2097152"

    "memorysetup-profiler-bucket-allocator-granularity=16"

    "memorysetup-profiler-bucket-allocator-bucket-count=8"

    "memorysetup-profiler-bucket-allocator-block-size=4194304"

    "memorysetup-profiler-bucket-allocator-block-count=1"

    "memorysetup-profiler-allocator-block-size=16777216"

    "memorysetup-profiler-editor-allocator-block-size=1048576"

    "memorysetup-temp-allocator-size-main=4194304"

    "memorysetup-job-temp-allocator-block-size=2097152"

    "memorysetup-job-temp-allocator-block-size-background=1048576"

    "memorysetup-job-temp-allocator-reduction-small-platforms=262144"

    "memorysetup-temp-allocator-size-background-worker=32768"

    "memorysetup-temp-allocator-size-job-worker=262144"

    "memorysetup-temp-allocator-size-preload-manager=262144"

    "memorysetup-temp-allocator-size-nav-mesh-worker=65536"

    "memorysetup-temp-allocator-size-audio-worker=65536"

    "memorysetup-temp-allocator-size-cloud-worker=32768"

    "memorysetup-temp-allocator-size-gfx=262144"

    2023-10-14 14:40:13.945597+0530 CricketGangsta[1125:316661] Setting up iOS 10 message delegate.

    -> applicationDidFinishLaunching()


    Setting UIViewControllerBasedStatusBarAppearance to NO is no longer supported.

    Apple actively discourages that, and all application-wide methods of changing status bar appearance are deprecated


    2023-10-14 14:40:14.753015+0530 CricketGangsta[1125:316661] UnityIAP UnityEarlyTransactionObserver: Added to the payment queue

    2023-10-14 14:40:14.916319+0530 CricketGangsta[1125:316661] got didFinishLaunching = (null)

    2023-10-14 14:40:14.963088+0530 CricketGangsta[1125:316918] [AppsFlyerSDK] [com.apple.main-thread] AppsFlyer SDK version 6.9.1 started build (92)

    2023-10-14 14:40:14.963744+0530 CricketGangsta[1125:316957] [AppsFlyerSDK] [com.apple.main-thread] Keychain items migration status: 0

    -> applicationDidBecomeActive()

    2023-10-14 14:40:14.984546+0530 CricketGangsta[1125:316661] got didBecomeActive(out) = (null)

    [Subsystems] Discovering subsystems at path /private/var/containers/Bundle/Application/89DF57FB-EEB5-41BF-A695-BA79DF718356/CricketGangsta.app/Data/UnitySubsystems

    GfxDevice: creating device client; threaded=1; jobified=0

    Initializing Metal device caps: Apple A8X GPU

    Initialize engine version: 2021.3.8f1 (b30333d56e81)

    The referenced script on this Behaviour (Game Object '<null>') is missing!

    The referenced script on this Behaviour (Game Object '<null>') is missing!

    The referenced script on this Behaviour (Game Object '<null>') is missing!

    The referenced script on this Behaviour (Game Object '<null>') is missing!

    The referenced script on this Behaviour (Game Object '<null>') is missing!

    CrashReporter: No pending report exists at /var/mobile/Containers/Data/Application/8AF778B4-FBE0-4301-8D45-C00710153C70/Library/Caches/CrashReports/crash-pending.plcrash

    2023-10-14 14:40:16.400759+0530 CricketGangsta[1125:316961] fopen failed for data file: errno = 2 (No such file or directory)

    2023-10-14 14:40:16.400949+0530 CricketGangsta[1125:316961] Errors found! Invalidating cache...

    The referenced script on this Behaviour (Game Object 'Main Camera') is missing!

    UnloadTime: 1.569709 ms

    This example uses Unity Engine OLD input system. If you are using new Input System and you want to use this example, please set your input configuration to BOTH.

    main ShowLoading 0

    #### Calling Firebase Inititlization!!

    Calling Firebase Inititlization!! >> internet is present

    2023-10-14 14:40:16.824586+0530 CricketGangsta[1125:316967] 9.3.0 - [FirebaseCore][I-COR000005] No app has been configured yet.

    2023-10-14 14:40:16.863538+0530 CricketGangsta[1125:316661] AppsFlyer Debug: handle deep link

    2023-10-14 14:40:16.957456+0530 CricketGangsta[1125:316661] Attempting to schedule a local notification without authorization, please call RequestAuthorization first.

    2023-10-14 14:40:16.957727+0530 CricketGangsta[1125:316661] Attempting to schedule a local notification without authorization, please call RequestAuthorization first.

    2023-10-14 14:40:16.958161+0530 CricketGangsta[1125:316661] Attempting to schedule a local notification without authorization, please call RequestAuthorization first.

    2023-10-14 14:40:16.958833+0530 CricketGangsta[1125:316661] Attempting to schedule a local notification without authorization, please call RequestAuthorization first.

    2023-10-14 14:40:17.091902+0530 CricketGangsta[1125:316916] 9.3.0 - [FirebaseCore][I-COR000005] No app has been configured yet.

    2023-10-14 14:40:17.092226+0530 CricketGangsta[1125:316916] 9.3.0 - [FirebaseCore][I-COR000003] The default Firebase app has not yet been configured. Add `FirebaseApp.configure()` to your application initialization. This can be done in in the App Delegate's application(_:didFinishLaunchingWithOptions:)` (or the `@main` struct's initializer in SwiftUI). Read more: https://goo.gl/ctyzm8.

    2023-10-14 14:40:17.093253+0530 CricketGangsta[1125:316916] 9.3.0 - [FirebaseCore][I-COR000005] No app has been configured yet.

    2023-10-14 14:40:17.110011+0530 CricketGangsta[1125:316661] [Firebase/Crashlytics] Version 9.3.0

    2023-10-14 14:40:17.127860+0530 CricketGangsta[1125:316958] 9.3.0 - [FirebaseAnalytics][I-ACS023007] Analytics v.9.3.0 started

    2023-10-14 14:40:17.128317+0530 CricketGangsta[1125:316958] 9.3.0 - [FirebaseAnalytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)

    2023-10-14 14:40:17.517613+0530 CricketGangsta[1125:316957] [connection] nw_resolver_start_query_timer_block_invoke [C1] Query fired: did not receive all answers in time for graph.facebook.com:443

    2023-10-14 14:40:17.518412+0530 CricketGangsta[1125:316957] [connection] nw_resolver_start_query_timer_block_invoke [C2] Query fired: did not receive all answers in time for graph.facebook.com:443

    2023-10-14 14:40:17.519370+0530 CricketGangsta[1125:316957] [connection] nw_resolver_start_query_timer_block_invoke [C3] Query fired: did not receive all answers in time for graph.facebook.com:443

    2023-10-14 14:40:17.843975+0530 CricketGangsta[1125:316918] Attribution returned an error: Error Domain=ADClientErrorDomain Code=1 "The app is not authorized for ad tracking" UserInfo={NSLocalizedDescription=The app is not authorized for ad tracking}

    2023-10-14 14:40:18.087474+0530 CricketGangsta[1125:316918] 9.3.0 - [FirebaseAnalytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement

    warning: UnityFramework was compiled with optimization - stepping may behave oddly; variables may not be available.

    (lldb)


    game getting crush very first launch second launch onwards working fine