googlesamples / googlesamples/unity-jar-resolver

[Bug][iOS] `NSInvalidArgumentException` after ugrading to 1.2.187

Open
#772 6 comments 0 reactions 0 assignees View on GitHub
Swift Package Manager
Dominant language
C#
Stars
1.5k
Forks
371
Avg merge
14h 21m
Merged PRs (30d)
3

Description

### [REQUIRED] Please fill in the following fields:

* Unity editor version: **2022.3.62f2**
* External Dependency Manager version: **1.2.187**
* Source you installed EDM4U: **unpacking .unitypackage as a private repo, then use it as a local package**
* Features in External Dependency Manager in use: **iOS Resolver might be the case here**
* Plugins SDK in use: **Adjust, AppsFlyer, Facebook, Firebase, Google-SignIn, TapDB (only those related are listed)**
* Platform you are using the Unity editor on: **Windows, built with *fastlane* in Mac**

### [REQUIRED] Please describe the issue here:
(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

We are trying to deprecate CocoaPods. With several packages still not having SwiftPM dependency yet, we figured out that if those Unity SDKs have their related iOS SDKs with SwiftPM settings, then it's feasible to forcibly activate it, by manually add SwiftPM information in corresponding Dependencies.xml.

To be more clearly, we applied this modification on Adjust, AppsFlyer, Facebook, Google-SignIn. Firebase has supported SwiftPM so we just upgraded it. TapDB is embedded in our project.

We have two environments with slight difference and notably Facebook SDK. The one with Facebook SDK works totally fine with this kind of customization, but the one without it will encounter `NSInvalidArgumentException` in the beginning and crashes immediately. The error comes from TapDB:
```log
{time, redacted} {device name, redacted} {game name, redacted}(UnityFramework)[4826] : Uncaught exception: NSInvalidArgumentException: -[TapDBEventMobile presetProperties]: unrecognized selector sent to instance 0x3032efae0
(
0 CoreFoundation 0x00000001914f9f34 F0207ED8-4FAD-3D5F-83CC-E3827289D1F1 + 1113908
1 libobjc.A.dylib 0x000000018ec85d8c objc_exception_throw + 72
2 CoreFoundation 0x0000000191560120 F0207ED8-4FAD-3D5F-83CC-E3827289D1F1 + 1532192
3 CoreFoundation 0x0000000191417d00 F0207ED8-4FAD-3D5F-83CC-E3827289D1F1 + 187648
4 CoreFoundation 0x0000000191417d7c _CF_forwarding_prep_0 + 92
5 UnityFramework 0x000000010e96073c tapdbEventQueue + 6056
6 UnityFramework 0x000000010e95f268 tapdbEventQueue + 724
7 libdispatch.dylib 0x0000000198c457e0 09169847-86AF-318F-936F-2E5908B9997F + 374752
8 libdispatch.dylib 0x0000000198c46a18 09169847-86AF-318F-936F-2E5908B9997F + 379416
9 libdispatc
```

And after a bunch of time debugging, we notice that this error still happens even if there is no package with SwiftPM setting customized. In this situation, only EDM4U is upgraded from 1.2.186 to 1.2.187.

```log
{time, redacted} {device name, redacted} {game name, redacted}(UnityFramework)[5102] : Uncaught exception: NSInvalidArgumentException: -[__NSDictionaryI setObject:forKey:]: unrecognized selector sent to instance 0x3038fb480
(
0 CoreFoundation 0x00000001914f9f34 F0207ED8-4FAD-3D5F-83CC-E3827289D1F1 + 1113908
1 libobjc.A.dylib 0x000000018ec85d8c objc_exception_throw + 72
2 CoreFoundation 0x0000000191560120 F0207ED8-4FAD-3D5F-83CC-E3827289D1F1 + 1532192
3 CoreFoundation 0x0000000191417d00 F0207ED8-4FAD-3D5F-83CC-E3827289D1F1 + 187648
4 CoreFoundation 0x0000000191417d7c _CF_forwarding_prep_0 + 92
5 AdjustSdk 0x0000000104e0fa3c -[ADJActivityHandler addGlobalCallbackParameterI:param:forKey:] + 480
6 AdjustSdk 0x0000000104e39858 __42+[ADJUtil launchInQueue:selfInject:block:]_block_invoke + 48
7 libdispatch.dylib 0x0000000198c457e0 09169847-86AF-318F-936F-2E5908B9997F + 374752
8 libdispatch.dylib
```

Since these two crashes come from two different packages, we think that this might be a bug in EDM4U, hence this issue report.

#### Please answer the following, if applicable:
What's the issue repro rate? (eg 100%, 1/5 etc)

**100%**

What happened? How can we make the problem occur?
This could be a description, log/console output, etc.

**Described above**

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the crash in a Unity iOS build with EDM4U 1.2.186 and 1.2.187, first without customized SwiftPM settings. Review the iOS Resolver behavior and the Dependencies.xml changes described in the report, then compare the generated build and logs. Done means identifying whether the EDM4U upgrade causes either package crash and documenting or correcting the regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, unity
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.