Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

Unable to read a property on method 'trackTiming #42

Closed
selimanac opened this issue May 8, 2014 · 10 comments
Closed

Unable to read a property on method 'trackTiming #42

selimanac opened this issue May 8, 2014 · 10 comments
Assignees
Labels

Comments

@selimanac
Copy link

Having this error: Unable to read a property on method 'trackTiming'
Flash Builder 4.7 + Air 4.0 - iOS

Any idea!?

if (Analytics.isSupported()) {
                Analytics.getInstance().debug = true;
                var analytics:Analytics = Analytics.getInstance();
                var tracker:ITracker = analytics.getTracker("UA-xxxxxxxxx");
                tracker.buildView("MainScreen").track();
            }

Thanks

@mrfrasier
Copy link

Same here, though I only seem to get it when I call timing:

ArgumentError: Unable to read a property on method 'TrackData:trackTiming'.
at flash.external::ExtensionContext/_call()
at flash.external::ExtensionContext/call()
at Tracker/send()[/Users/alessandro.bianco/SkyDrive/Workspace/Personal/ANE-Google-Analytics/source/actionscript/agnostic/src/eu/alebianco/air/extensions/analytics/Tracker.as:127]
at TimingBuilder/track()[/Users/alessandro.bianco/SkyDrive/Workspace/Personal/ANE-Google-Analytics/source/actionscript/agnostic/src/eu/alebianco/air/extensions/analytics/TimingBuilder.as:47]

Code:

    public function trackLoadTime( name:String, duration:uint, label:String = null, activity:String = 'loading' ):void{
        if( !Analytics.isSupported() ) return;
        var event:ITimingBuilder = googleTracker.buildTiming( activity, duration ).withName( name );
        if( label != null ) event.withLabel( label );
        event.track();
        trace( "Tracked GA Load Time", activity, name, duration, label );           
    }

No issue with IEventBuilder

@selimanac
Copy link
Author

Any idea!?

@mrfrasier
Copy link

It sort of seems to be an issue with the initialization of the ANE. These calls all work if you call them later in the app, but I was calling mine somewhat early-on.

I haven't been able to pin down what the "cut-off" period is, however.

@alebianco
Copy link
Owner

sorry guys for the delay, i will need to do some tests to verify it but i was just looking at the code and i can say you two things:

  1. there's no warm-up period, as soon as you get an instance of a tracker you can start using it
  2. from the code i can see that the message that @mrfrasier posted is due to not being able to read either the category or interval properties. double check if you're sending null values because that could mess it up
  3. @mrfrasier has issues on android but @selimanac reported it to be on iOS. it could be a cross-platform issue but i really want to stress the importance of reporting as many info as possible: platform, version of the extension etc ...

i'll get back to you as soon as i can run some tests

@mrfrasier
Copy link

Sorry, I'm developing for both platforms at once, so I didn't think to specify. I tried it this morning and it worked 100% fine on Android. Will publish on iOS now (always a longer process) and see what's up.

@mrfrasier
Copy link

Ok, got it to happen again on iOS. Looks like the duration passed was huge (coding issue on my end). So I guess null or values that are too large can cause this:

code:
googleTracker is [object Tracker]
Tracked GA Load Time with params: amfCall loadTracks 4294967295 null
ArgumentError: Unable to read a property on method 'trackTiming'.
at flash.external::ExtensionContext/call()
at Tracker/send()[/Users/alessandro.bianco/SkyDrive/Workspace/Personal/ANE-Google-Analytics/source/actionscript/agnostic/src/eu/alebianco/air/extensions/analytics/Tracker.as:127]
at TimingBuilder/track()[/Users/alessandro.bianco/SkyDrive/Workspace/Personal/ANE-Google-Analytics/source/actionscript/agnostic/src/eu/alebianco/air/extensions/analytics/TimingBuilder.as:47]
at com.idlemedia.common.starling_apps::StarlingGame/trackLoadTime()[C:\Projects\idlemedia dev\flash\com\idlemedia\common\starling_apps\StarlingGame.as:294]
at com.idlemedia.sites.datpiff.mobilev4_5::DatPiff45StarlingEngine/onAMFData()[C:\Projects\idlemedia dev\flash\com\idlemedia\sites\datpiff\mobilev4_5\DatPiff45StarlingEngine.as:404]
at com.idlemedia.sites.datpiff.mobilev4_5::DatPiff45StarlingEngine/onAMFData()
at flash.events::EventDispatcher/dispatchEvent()
at com.idlemedia.utils::AMFLoader/onResult()[C:\Projects\idlemedia dev\flash\com\idlemedia\utils\AMFLoader.as:111]
at com.idlemedia.utils::AMFLoader/onResult()
Cannot display source code at this location.

@alebianco
Copy link
Owner

would the duration number be bigger than the int limit? 2,147,483,647?
the API uses a uint which has a bigger limit, but then it might cause an error during the conversion in the native side i guess.
maybe i could change the API to make it a bit more consistent ..

I added a story on trello to keep track of it https://trello.com/c/9u7f8zOK/34-change-timing-traker-api-to-use-int-to-avoid-conversion-issues-with-big-numbers

@alebianco alebianco self-assigned this May 15, 2014
@alebianco alebianco added the bug label May 15, 2014
@selimanac
Copy link
Author

Looks like its a new compiler problem.
When i use "-useLegacyAOT no" for standart debug packaging it gives an error: "Having this error: Unable to read a property on method 'trackTiming/trackView/trackSocial'".

When i remove useLegacyAOT and package, dont have any error and it works.

Thanks

@alebianco
Copy link
Owner

oh yeah, it could be, the AOT compiler is not very reliable yet

i'm not planning to give AOT official support until it's stable but i'll stick a new story to some tests with it. thanks for pointing it out

@mrfrasier
Copy link

It shouldn't ever be that big, that was an error in my code. I've now put a check before any calls to stop any big numbers from going in should they happen.

Thanks again!

Sent from my iPhone

On May 15, 2014, at 4:10 AM, Alessandro Bianco [email protected] wrote:

would the duration number be bigger than the int limit? 2,147,483,647?
the API uses a uint which has a bigger limit, but then it might cause an error during the conversion in the native side i guess.
maybe i could change the API to make it a bit more consistent ..


Reply to this email directly or view it on GitHub.

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

No branches or pull requests

3 participants