1. 程式人生 > >友盟統計和友盟反饋的新增

友盟統計和友盟反饋的新增

在相應的介面新增

匯入#import "UMFeedback.h",以及新增代理

UMFeedbackDataDelegate

在相應的.m檔案裡面加入

//新增友盟反饋

    [UMFeedback setLogEnabled:YES];

    [UMFeedback checkWithAppkey:UMENG_APPKEY];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(umCheck:) name:UMFBCheckFinishedNotification object:nil];

在點選實現的方法裡面新增

[UMFeedback showFeedback:self withAppkey:UMENG_APPKEY];

//觀察者相應的實現方法

- (void)umCheck:(NSNotification *)notification {

//    UIAlertView *fanKuiAlertView;

    if (notification.userInfo) {

        NSArray *newReplies = [notification.userInfo objectForKey:@"newReplies"];

        NSLog(@"newReplies = %@", newReplies);

        NSString *title = [NSString stringWithFormat:@"%d條新回覆", [newReplies count]];

        NSMutableString *content = [NSMutableString string];

        for (NSUInteger i = 0; i < [newReplies count]; i++) {

            NSString *dateTime = [[newReplies objectAtIndex:i] objectForKey:@"datetime"];

            NSString *_content = [[newReplies objectAtIndex:i] objectForKey:@"content"];

            [content appendString:[NSString stringWithFormat:@"%d .......%@.......\r\n", i + 1, dateTime]];

            [content appendString:_content];

            [content appendString:@"\r\n\r\n"];

        }

        fanKuiAlertView = [[UIAlertView alloc] initWithTitle:title message:content delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"檢視", nil];

        if ([[UIDevice currentDevice].systemVersion floatValue] < 7.0f) {

            ((UILabel *) [[fanKuiAlertView subviews] objectAtIndex:1]).textAlignment = NSTextAlignmentLeft;

        }

    } else {

        fanKuiAlertView = [[UIAlertView alloc] initWithTitle:@"沒有新回覆" message:nil delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil];

    }

    [fanKuiAlertView show];

}

把這些新增之後就可以進入友盟的客戶端的使用者反饋資訊介面,這時候登入友盟的網頁資訊,可以看到使用者的反饋資訊,當開發者在此回覆的時候,客戶就可以在自己的反饋介面實現彈出回覆資訊提示。

這樣友盟的統計和反饋都新增完畢了。

}{}}


}}}}}}

}