mParticle / mparticle-apple-sdk

mParticle Apple SDK
Apache License 2.0
45 stars 66 forks source link

MParticle forward setLocation selector to Braze (Appboy) which is not supported #260

Open menasameh opened 6 months ago

menasameh commented 6 months ago

I was getting those 2 messages in the console

mParticle -> Forwarded selector: setLocation: is not supported by this kit
mParticle -> Failed to Forward to Kit

And after some investigation, According to this block of code

- (void)setLocation:(CLLocation *)location {
    if (![[MParticle sharedInstance].stateMachine.location isEqual:location]) {
        [MParticle sharedInstance].stateMachine.location = location;
        MPILogDebug(@"Set location %@", location);

        dispatch_async(dispatch_get_main_queue(), ^{
            [MPListenerController.sharedInstance onAPICalled:_cmd parameter1:location];

            // Forwarding calls to kits
            MPForwardQueueParameters *queueParameters = [[MPForwardQueueParameters alloc] init];
            [queueParameters addParameter:location];

            [[MParticle sharedInstance].kitContainer forwardSDKCall:_cmd
                                                              event:nil
                                                         parameters:queueParameters
                                                        messageType:MPMessageTypeEvent
                                                           userInfo:nil
             ];
        });
    }
}

When we provide a new location it will loop through the activeKitsRegistry and try to forward the message to each active kit, however for Braze (Appboy) the setLocation selector is not supported, that's why I'm getting these messages in the console.

we should use one of those two instead

[AppDelegate.braze.user setLastKnownLocationWithLatitude:latitude
                                               longitude:longitude
                                      horizontalAccuracy:horizontalAccuracy];
[AppDelegate.braze.user setLastKnownLocationWithLatitude:latitude
                                               longitude:longitude
                                      horizontalAccuracy:horizontalAccuracy
                                                altitude:altitude
                                        verticalAccuracy:verticalAccuracy];

According to Braze (Appboy) docs

So I have 2 questions