|
/

iOS应用内消息怎么不弹出来

FFeyddy
发布于 5 年前
245
消息推送 U-Push

iOS应用内消息集成了之后,后天推送应用内消息,APP不显示弹框!

2个回答
 
5 年前

我在appdelegate中

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

{

[UMConfigure initWithAppkey:@"xxx" channel:@"App store"];

// Push组件基本功能配置

UMessageRegisterEntity * entity = [[UMessageRegisterEntity alloc] init];

//type是对推送的几个参数的选择,可以选择一个或者多个。默认是三个全部打开,即:声音,弹窗,角标

entity.types = UMessageAuthorizationOptionBadge|UMessageAuthorizationOptionSound|UMessageAuthorizationOptionAlert;

[UNUserNotificationCenter currentNotificationCenter].delegate=self;

[UMessage registerForRemoteNotificationsWithLaunchOptions:launchOptions Entity:entity completionHandler:^(BOOL granted, NSError * _Nullable error) {

if (granted) {

NSLog(@"deviceToken1111111");

}else{

NSLog(@"deviceToken2222222");

}

}];

[UMessage setAutoAlert:YES];//设置是否允许SDK当应用在前台运行收到Push时弹出Alert框

[UMessage setBadgeClear:YES];//设置是否允许SDK自动清空角标

[UMessage openDebugMode:YES];//必须先调用,开启后才能在后台展示

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

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

self.window.rootViewController = rootViewController;

[self.window makeKeyAndVisible];

return YES;

}

在ViewController中

- (void)viewDidLoad {

[super viewDidLoad];

self.view.backgroundColor = [UIColor whiteColor];

[UMessage addCardMessageWithLabel:@"sss"];//设置了标签后才能在后台选择

}

然后在友盟后台直接使用测试模式推送应用内消息,没有弹框出现。

哪位大神能帮忙看下我哪里错了吗?谢谢!

 
5 年前

集成代码要发出来呀,不然大家怎么帮你解决。肯定是你集成的时候,有啥没配好的。

Loading ...
登录社区,分享你的经验