PiwikPRO / piwik-pro-sdk-framework-ios

MIT License
2 stars 2 forks source link

+[NSString platformName]: unrecognized selector sent to class 0x204da8948 for iOS SDK #9

Open adeel-7peaks opened 8 months ago

adeel-7peaks commented 8 months ago

I have implemented PiwikPro sdk for iOS and try to send screen_view event.

Following is the code is set in AppDelegate.swift file

PiwikTracker.sharedInstance(siteID: {site_id}, baseURL: {BASE_URL})
        PiwikTracker.sharedInstance()?.isAnonymizationEnabled = true
        PiwikTracker.sharedInstance()?.isPrefixingEnabled = true

When i try to log the screen event using its new object PiwikTracker()

PiwikTracker().sendView(view: screen_name)

Nothing happens on "Debug Tracker"

And when i try to log using its sharedInstance()

PiwikTracker.sharedInstance()?.sendView(view: "screen_name")

the application crashes with follwing error

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSString platformName]: unrecognized selector sent to class 0x204da8948' First throw call stack: (0x1aebbe248 0x1a7f8ba68 0x1aed32328 0x1aebd4360 0x1aec3c660 0x10129533c 0x101293864 0x101292c80 0x101292bac 0x10128ed70 0x10128ecc4 0x100fc56e0 0x100fd0a60 0x100fd0ab0 0x1b0d4f714 0x1b0f68650 0x1b0f684c8 0x1b0e93104 0x23352e644 0x1b0f4522c 0x1b0ff985c 0x1b1544e98 0x1b1d671b0 0x1b0e14114 0x1b0e13070 0x1b0e12790 0x233581514 0x1b0e128a4 0x233581514 0x1b022cae8 0x1022fe04c 0x10230e800 0x10230e344 0x1aec4ea08 0x1aec30368 0x1aec351e4 0x1e7a55368 0x1b10e4d88 0x1b10e49ec 0x101244a38 0x1ccf59948) libc++abi: terminating with uncaught exception of type NSException

Is there anything I am missing?

And btw the sendView is being called from a UIViewController's viewDidLoad() and viewDidAppear() methods

Thanks.

PS: I have setup sdk using Pods and the version is PiwikPROSDK (1.2.3)

camiloiOSSOT commented 6 months ago

+1

Could be an issue related to project setup?

camiloiOSSOT commented 6 months ago

@adeel-7peaks We fixed!!!

Review point 6 on the sdk setup: https://developers.piwik.pro/en/latest/data_collection/mobile/Piwik_PRO_SDK_for_iOS.html#sdk-integration-swift-package-manager

Lutzifer commented 1 day ago

I had to use

-all_load

as a linker flag, as the

-ObjC

flag was not enough.