ox-push2-ios-pod 0.1.3

ox-push2-ios-pod 0.1.3

测试已测试
语言语言 Obj-CObjective C
协议 MIT
发布最后发布2022年2月

Nazar Yavornytskyy维护。



 
依赖关系
AFNetworking>= 0
NHNetworkTime>= 0
NSHash>= 0
 

  • 出自
  • NazarYavornytskyy

如何安装

要使用ox-push2框架,您可以编辑您的Podfile,只需添加以下内容

  pod 'ox-push2-ios-pod', :git => 'https://github.com/GluuFederation/ox-push2-ios-pod.git'

或者将“ox-push2-ios-pod”文件夹复制并粘贴到您的项目文件夹中

如何使用

首先,您需要创建OXPushManager类的对象

  OXPushManager* oxPushManager = [[OXPushManager alloc] init];

还建议设置设备的推送通知令牌。在设备注册时,Gluu的服务器应用会发送推送通知令牌以及UDID,之后当您尝试进行认证请求时,您将收到包含认证请求数据的推送。设置令牌,只需使用“setDevicePushToken”方法即可。

  [oxPushManager setDevicePushToken:@"deviceToken"];

要发送注册/认证请求,您应该调用“onOxPushApproveRequest”方法

  [oxPushManager onOxPushApproveRequest:jsonDictionary isDecline:NO callback:^(NSDictionary *result,NSError *error){
    if (error) {
        [self showAlertViewWithTitle:@"Info" andMessage:@"Authentication failed"];
    } else {
        //Success
        [self showAlertViewWithTitle:@"Info" andMessage:@"Authentication success"];
    }
}];

参数

  • jsonDictionary: 包含请求数据的字典
  • isDecline: 一个布尔参数,用于告知oxPush2库是否批准请求
  • callback: 简单的回调方法,返回结果和错误