iOS接阿里百川反馈SDK

正常的添加阿里百川的依赖库,具体参考官方文档。地址如下:
https://baichuan.taobao.com/doc2/detail.htm?spm=a3c0d.7629140.0.0.cCQwwt&treeId=118&articleId=104173&docType=1

其他的就是参考官方demo写的,注意一点的是要写明环境。
key是跟阿里申请的

//反馈(阿里百川)
                    self.appKey = @"******";

                    //匿名反馈
                    self.feedbackKit = [[YWFeedbackKit alloc] initWithAppKey:self.appKey];

// 开发者的线上环境
                    _feedbackKit.environment = YWEnvironmentRelease;

#warning 设置App自定义扩展反馈数据
//                    _feedbackKit.extInfo = @{@"loginTime":[[NSDate date] description],
//                                             @"visitPath":@"登陆->关于->反馈",
//                                             @"应用自定义扩展信息":@"开发者可以根据需要设置不同的自定义信息,方便在反馈系统中查看"};
#warning 自定义反馈页面配置
//                    _feedbackKit.customUIPlist = [NSDictionary dictionaryWithObjectsAndKeys:@"/te\'st\\Value1\"", @"testKey1", @"test<script>alert(\"error.yaochen\")</alert>Value2", @"testKey2", nil];

                    [self _openFeedbackViewController];
- (void)_openFeedbackViewController
{
    __weak typeof(self) weakSelf = self;

    //登录并创建反馈页面
    [_feedbackKit makeFeedbackViewControllerWithCompletionBlock:^(YWFeedbackViewController *viewController, NSError *error) {
        if ( viewController != nil ) {
//#warning 这里可以设置你需要显示的标题
            viewController.title = @"反馈界面";

            UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewController];
            [weakSelf presentViewController:nav animated:YES completion:nil];

            viewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"关闭" style:UIBarButtonItemStylePlain target:weakSelf action:@selector(actionQuitFeedback)];

//            viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"清除缓存" style:UIBarButtonItemStylePlain
//             target:weakSelf action:@selector(actionCleanMemory:)];

            __weak typeof(nav) weakNav = nav;

            [viewController setOpenURLBlock:^(NSString *aURLString, UIViewController *aParentController) {
                UIViewController *webVC = [[UIViewController alloc] initWithNibName:nil bundle:nil];
                UIWebView *webView = [[UIWebView alloc] initWithFrame:webVC.view.bounds];
                webView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;

                [webVC.view addSubview:webView];
                [weakNav pushViewController:webVC animated:YES];
                [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:aURLString]]];
            }];
        } else {
//            NSString *title = [error.userInfo objectForKey:@"msg"]?:@"接口调用失败,请保持网络通畅!";
//            [[TWMessageBarManager sharedInstance] showMessageWithTitle:title description:nil
//            type:TWMessageBarMessageTypeError];

        }
    }];

}

效果图:
这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值