Search code examples
iphoneiosgoogle-analyticsextend

GoogleAnalytics in IOS and extend more then two classes?


I am trying to implement GoogleAnalytics to my IOS app and come across the following problem: if you want to initialize the tracker in GA to a specific view (lets call it view X), you need to extend class GAITrackedViewController.h to the view X.

In my case, I already extend another class in my project and as we all know you can not extend 2 classes. So therefor I wonder, how do I solve this in objective C ? Keep in mind I am not a very experienced programmer and I am also new to objective C.

I will post my HomeViewController.h which is being referred as View X example above. As you can see it already extends MLUIViewController. If I also want to extend GAITrackedViewController to enable GoogleAnalytics, how do I achieve this? / Regards

#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>

@interface HomeViewController : MLUIViewController <UITableViewDelegate,  UITableViewDataSource, UISearchBarDelegate, UIActionSheetDelegate, UIAlertViewDelegate, MFMailComposeViewControllerDelegate, UIGestureRecognizerDelegate, MLSearchTaskDelegate,  MLDeactivateDelegate>

{
IBOutlet UITableView *tableView;
IBOutlet UIBarButtonItem *menuButton;

IBOutlet UILabel *infoViewTitle;
IBOutlet UIView *infoView;

......................

Solution

  • Just make MLUIViewController to inherit from GAITrackedViewController and implement GAITrackedViewController functionalities in HomeViewController.