远程通知Ios
我已经在我的应用程序中实现了推送通知 我收到的AP如下:远程通知Ios,ios,objective-c,push-notification,Ios,Objective C,Push Notification,我已经在我的应用程序中实现了推送通知 我收到的AP如下: { aps = { alert = "Bhai kaisa hai notification a rha hai!"; customtitle = "Customtitle here"; keyid = 8; sound = default; }; } 我想将keyid和customtitle传递给视图控制器我的代码: NSString * ti
{
aps = {
alert = "Bhai kaisa hai notification a rha hai!";
customtitle = "Customtitle here";
keyid = 8;
sound = default;
};
}
我想将keyid和customtitle传递给视图控制器我的代码:
NSString * titletopass = [userInfo objectForKey:@"customtitle"];
NSString * keytopass = [userInfo objectForKey:@"keyid"];
//NSString *titletopass=[getpass objectForKey:@"customtitle"];
PostsDetailsViewController *obj = [[PostsDetailsViewController alloc]init];
obj.Viewtitle = titletopass;
obj.key=keytopass;
NSString *identifier;
identifier=@"postsdetails";
UIStoryboard * storyboardobj=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
obj = [storyboardobj instantiateViewControllerWithIdentifier:identifier];
[self.window setRootViewController:obj];
它不会将数据传递给viewcontroller,并且keytopass+titletopass也是空的
提前感谢。将
obj
设置为PostDetailsViewController
的实例后,您将obj
设置为从情节提要实例化的postdetails
视图控制器
如果您打算使用故事板,那么您应该仅从中创建实例。拥有实例后,可以设置属性
例如:
NSString * titletopass = [[userInfo objectForKey:@"aps"] objectForKey:@"customtitle"];
NSString * keytopass = [[userInfo objectForKey:@"aps"] objectForKey:@"keyid"];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PostsDetailsViewController *obj = (PostDetailsViewController *)[storyboard instantiateViewControllerWithIdentifier:@"postdetails"];
obj.Viewtitle = titletopass;
obj.key=keytopass;
[self.window setRootViewController:obj];
将
obj
设置为postdailsviewcontroller
的实例后,将obj
设置为从情节提要实例化的postdails
视图控制器
如果您打算使用故事板,那么您应该仅从中创建实例。拥有实例后,可以设置属性
例如:
NSString * titletopass = [[userInfo objectForKey:@"aps"] objectForKey:@"customtitle"];
NSString * keytopass = [[userInfo objectForKey:@"aps"] objectForKey:@"keyid"];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PostsDetailsViewController *obj = (PostDetailsViewController *)[storyboard instantiateViewControllerWithIdentifier:@"postdetails"];
obj.Viewtitle = titletopass;
obj.key=keytopass;
[self.window setRootViewController:obj];
我无法从我的{aps={alert=“Bhai kaisa hai!”编辑答案的customtitle=“customtitle here”;keyid=8;sound=default;};}中获取标题内容。您在
aps
对象中拥有这些属性。我无法从我的“{aps={alert=“Bhai kaisa hai notification a rha hai!”;customtitle=“customtitle here”;keyid=8;sound=default;};}”编辑的答案中获取titletopass。您在aps
对象中拥有这些属性。