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)