mParticle/mparticle-apple-sdk

mParticle v8.0.1 crash running app in Release mode

Closed this issue · 2 comments

We recently updated mParticle to version 8.0.1 via Cocoapods and Apple rejected our binary due a crash caused during the app review. Below are the details of the crash:

iOS version:

14.0.1

Pod versions:

pod 'mParticle-Apple-SDK', '~> 8.0.1'
pod 'mParticle-Localytics', '~> 8.0.1'

Crash occurs at line 312 in MPKitLocalytics.m
Exception:

-[__NSArrayI objectAtIndexedSubscript:]: index 22 beyond bounds [0 .. 9]
-[MPKitLocalytics setUserIdentity:identityType:]

Snippet of line where crash occurs (MPKitLocalytics.m line 312):

NSArray *identifierStrings = @[@"Other", @"CustomerId", @"Facebook", @"Twitter", @"Google", @"Microsoft", @"Yahoo", @"Email", @"Alias", @"FacebookCustomAudienceId"];
NSString *identifier = identifierStrings[(NSInteger)identityType];

Value of identityType:
"MPUserIdentityYahoo | MPUserIdentityOther8"
Value of (NSInteger)identityType:

Release configuration:

switch UIApplication.AppConfiguration.appEnvironment  {
    case .release:
        mParticleOptions.environment = .production
        mParticleOptions.logLevel = .none
        mParticleOptions.uploadInterval = 120 // 2 min
    case .development:
        mParticleOptions.environment = .development
        mParticleOptions.logLevel = .none
    }

Crash log:

Fatal Exception: NSRangeException
0  CoreFoundation                 0x1a3ac25ac __exceptionPreprocess
1  libobjc.A.dylib                0x1b7b3c42c objc_exception_throw
2  CoreFoundation                 0x1a3b314cc -[__NSCFString characterAtIndex:].cold.1
3  CoreFoundation                 0x1a39bfc5c -[NSDate dateByAddingTimeInterval:]
4  mParticle_Localytics           0x1044d24ac -[MPKitLocalytics setUserIdentity:identityType:] + 312 (MPKitLocalytics.m:312)
5  mParticle_Apple_SDK            0x10440e658 -[MPKitContainer configureKits:] + 2022 (MPKitContainer.mm:2022)
6  mParticle_Apple_SDK            0x1043f0b68 __64-[MPIdentityApi onMPIDChange:httpResponse:previousUser:newUser:]_block_invoke.159 + 252 (MPIdentityApi.m:252)
7  libdispatch.dylib              0x1a36befd0 _dispatch_call_block_and_release
8  libdispatch.dylib              0x1a36c0ac8 _dispatch_client_callout
9  libdispatch.dylib              0x1a36ce04c _dispatch_main_queue_callback_4CF
10 CoreFoundation                 0x1a3a3f1e4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
11 CoreFoundation                 0x1a3a393b4 __CFRunLoopRun
12 CoreFoundation                 0x1a3a384bc CFRunLoopRunSpecific
13 GraphicsServices               0x1ba4bd820 GSEventRunModal
14 UIKitCore                      0x1a63dc734 -[UIApplication _run]
15 UIKitCore                      0x1a63e1e10 UIApplicationMain
16 My_App                         0x1020a8abc main + 17 (ViewModel.swift:17)
17 libdyld.dylib                  0x1a36ffe60 start

Thank you!

Thank you for the detailed report--we are investigating a fix and will let know you when it's live.

In case you want to follow along, here is the PR where the changes are currently undergoing testing and code review: mparticle-integrations/mparticle-apple-integration-localytics#6

This is released as mParticle-Localytics 8.0.2