alooi14 / analytics-issues

Automatically exported from code.google.com/p/analytics-issues
0 stars 1 forks source link

iOS - self.tracker returns nil #322

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
---------------------------------------------------------------------------
NOTE: This issue tracking system is for Google Analytics developer products
only.
If you are not a developer/programmer visit:
http://www.google.com/analytics/support.html
---------------------------------------------------------------------------
Name of affected component: Mobile Tracking

Name of related library and version, if applicable (e.g. Android, iOS,
Snippets, etc.):
iOS Version 2.0beta4 

Issue summary:
My viewController extents GAITrackedViewController.
But when I call self.tracker to log an event the tracker return is always `nil`.
I have set the trackedViewName of the viewController in the viewDidLoad.

Steps to reproduce issue:
1. Create a new viewController extending GAITrackedViewController
2. Set the  trackedViewName in the viewDidLoad
3. Call the self.tracker in a button 

Expected output:
A track which is not `nil`.

Actual results:
the track is `nil`.

Notes:
The doucmentation of the property states that id `nil` that the  [GAI 
defaultTracker]  wil be returned which is not the case:
    The tracker on which view tracking calls are be made, or `nil`, in which case
     [GAI defaultTracker] will be used.

Original issue reported on code.google.com by rckoe...@gmail.com on 6 Aug 2013 at 9:30

GoogleCodeExporter commented 9 years ago
self.tracker will return `nil` if it has not been initialized, i.e. if this 
line of code has not yet been run:

id<GAITracker> tracker = [[GAI sharedInstance] 
trackerWithTrackingId:@"UA-YOUR-TRACKING-ID"];

Can you provide more sample code to confirm whether you have initialized the 
tracker?

Original comment by awa...@google.com on 9 Nov 2013 at 12:40