iOS 友盟统计~统计界面次数

作者: 石虎132 | 来源:发表于2017-11-10 22:56 被阅读157次

    //联系人:石虎QQ:1224614774昵称:嗡嘛呢叭咪哄

    一、概念

    #import"AppDelegate.h"

    #import"MobClick.h"

    #import"ViewController.h"

    @interfaceAppDelegate ()

    @end

    @implementationAppDelegate

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    //1.初始化友盟统计模块

    [MobClick startWithAppkey:@"是申请的 Key 名例如是 abcvxsdhufh"reportPolicy:BATCH   channelId:nil];

    //配置

    NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];

    [MobClick setAppVersion:version];

    //设置ViewController添加到导航栏上

    ViewController *vc = [[ViewController alloc]init];

    UINavigationController * nvc = [[UINavigationController alloc]initWithRootViewController:vc];

    //ViewController为主控制器

    self.window.rootViewController = nvc;

    self.window.backgroundColor = [UIColor whiteColor];

    returnYES;

    }

    二、页面实现代码

    //视图将要显示的时候

    - (void)viewWillAppear:(BOOL)animated

    {

    [superviewWillAppear:animated];

    //开始视图里面的日志页面:

    [MobClick beginLogPageView:@"PageOne"];

    }

    //视图将要消失的时候

    - (void)viewWillDisappear:(BOOL)animated

    {

    [superviewWillDisappear:animated];

    [MobClick endLogPageView:@"PageOne"];

    }

    谢谢!!!

    相关文章

      网友评论

        本文标题:iOS 友盟统计~统计界面次数

        本文链接:https://www.haomeiwen.com/subject/ahgimxtx.html