Add data statistics to your app (Friends League)

Source: Internet
Author: User

1. First add a new application to the Friends Alliance platform, apply for a new application, and then get a appkey.

2. Download the SDK file for iOS platform and drag the following two files into the project.

  (1)libMobClickLibrary.a

  (2)MobClick.h

3. Add a class library:

Targets-->build Phases-->link Binary with libraries--> +-->libz.dylib (Xcode7 please select LIBZ.TBD)

If added using Cocopod, available: (Pod ' umenganalytics ').

4. Implement the relevant methods:

#import <Foundation/Foundation.h>@interface  statecollect:nsobject+ (void  ) setup; + (void) Intopage: (NSString *) pageName; + (void) Outpage: (NSString *) pageName; + (void)Event:(NSString *)event        *) value; @end
#import "StateCollect.h"#import "MobClick.h"#defineChannelenterprise @ "Enterprise"@implementationStatecollect#defineUmengkey @ "" + (void) setup{NSString*chanel =channelenterprise;#ifdefAppStore Chanel=Channelappstore;#endif[Mobclick startwithappkey:umengkey reportpolicy:realtime Channelid:chanel]; }+ (void) Intopage: (NSString *) pagename{[Mobclick beginlogpageview:pagename];}+ (void) Outpage: (NSString *) pagename{[Mobclick endlogpageview:pagename];}+ (void)Event:(NSString *)Eventvalue: (NSString*) value{[MobclickEvent:Eventlabel:value];}

5. Create a link in appdelegate:

[statecollect setup];

Note: The NSObject page that Statecollect created for me

6. The method of adding call statistics to the statistics interface:

-(void) viewwillappear: (BOOL) animated{    [Super viewwillappear:animated];     class ])];} -(void) viewwilldisappear: (BOOL) animated{    [Super viewwilldisappear:animated];     class ])];}

7. If you have added statistics about events in your friend's my application, you can call this method for statistics:

[statecollect event:@ "Login" value:nsstringfromclass([ Self class]);

Note: Login is the related event that I set up.

8. If you are using the league for the first time, you need to use it in: my products---Settings--Application information:

After completing the above setup, run the program and find the following error:

" _compress2 " , referenced from:       inch For 1 (use-v to see invocation)   

Can be resolved by setting the value of other Linker flag not-lz.

similar to other"_compress2", referenced from:"_inflatereset", referenced from:"_inflateinit_", referenced from:"_inflateend", referenced from:"_inflateinit2_", referenced from:can be solved by-lz.  -lz will let your program against the built-in zlib at compile time to solve the problem

Add data statistics to your app (Friends League)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.