Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSAssert: Key url is a NSURL and can't be serialized for delivery #947

Closed
krin-san opened this issue Oct 8, 2020 · 14 comments
Closed

NSAssert: Key url is a NSURL and can't be serialized for delivery #947

krin-san opened this issue Oct 8, 2020 · 14 comments

Comments

@krin-san
Copy link

krin-san commented Oct 8, 2020

Segment cannot handle app start options dictionary on iOS 14 when it contains deeplink url (when application was started to handle that deep link).

Related to #937 and #936
Affected version: v4.0.5 and 7a8387b (latest master at the moment of testing).
iOS version: 14.0.1
IDE: Xcode 12.0.1

Issues:

  • Assertion in -[NSDictionary(SerializableDeepCopy) serializableDeepCopy:] on DEBUG builds
  • Missing tracking data (deep link) on other builds

Reasons:

Screenshot 2020-10-08 at 09 30 27

LLDB log at selected stack trace point:

po note.userInfo
{
    UIApplicationLaunchOptionsURLKey = "my_app://deeplink";
}

po [note.userInfo[@"UIApplicationLaunchOptionsURLKey"] class]
NSURL
@krin-san
Copy link
Author

krin-san commented Oct 8, 2020

Adding [obj isKindOfClass:[NSURL class]] || to the list of serializable classes seem to fix this issue.

@dannyhertz
Copy link

Im running into this issue as well. Were you able to patch it locally @krin-san or did you have to fork the library and fix it yourself?

@krin-san
Copy link
Author

krin-san commented Oct 9, 2020

@dannyhertz I patched SEGUtils.m in place, right in Pods folder to see if that's enough. On Monday I can prepare a PR if no one wants to make that earlier.

@krin-san
Copy link
Author

@dannyhertz it took some time to prioritize and test that, but PR is ready.
Could you check if that fixes your issue too? To install the fork change your Podfile like that:

- pod 'Analytics'
+ pod 'Analytics', :git => 'https://github.com/krin-san/analytics-ios.git', :branch => 'bugfix/launch_with_deeplink'

@migs647
Copy link
Contributor

migs647 commented Oct 28, 2020

We're looking at this today

@sanhue0302
Copy link

I think this is same problem as #959 ?

@darrenspriet
Copy link

Any idea when this fix is going in?

@bsneed
Copy link
Contributor

bsneed commented Nov 3, 2020

Should have this resolved tomorrow. #959 shed a little more light on the issue.

@bsneed bsneed closed this as completed Nov 3, 2020
@bsneed bsneed reopened this Nov 3, 2020
@bsneed
Copy link
Contributor

bsneed commented Nov 3, 2020

Oops, closed by mistake. Meant to hit the comment button.

@darrenspriet
Copy link

Issue I am having is opening a URL from a widget in the non-running state. I get the crashed described above. And adding this line actually fixes it [obj isKindOfClass:[NSURL class]] | as described. Is this fix or another fix resolving this issue in a release available?

@sanhue0302
Copy link

sanhue0302 commented Nov 4, 2020

Doesn't NSURL confirms to SEGSerializable?
There is a category in SEGAnalyticsUtils.m

I think It will return YES in SEGUtil.m:509
in my case , the problem will be fixed by change code as below:

        if ([aValue conformsToProtocol:@protocol(SEGSerializableDeepCopy)]) {
            theCopy = [aValue serializableDeepCopy:mutable];
        // change order of conformsToProtocol to SEGSerializable and NSCopying
        } else if ([aValue conformsToProtocol:@protocol(SEGSerializable)]) {
            theCopy = [aValue serializeToAppropriateType];
        } else if ([aValue conformsToProtocol:@protocol(NSCopying)]) {
            theCopy = [aValue copy];
        } else {
            theCopy = aValue;
        }

@darrenspriet
Copy link

Awesome, I see the change in 4.1.0. I was trying to find which release the change went into. Thank you for clarifying!

@bsneed
Copy link
Contributor

bsneed commented Nov 4, 2020

Fixed! Will be on master to try out shortly. Release coming soon.

@bstillitano
Copy link

This is still happening with iOS 16 using analytics-ios 4.1.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants