- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
AppDelegate 能否在收到推送通知后在 View Controller 中运行“功能”?
应用程序包含三个选项卡,第三个选项卡需要在应用程序收到推送通知时重新加载其 webview。
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
}
1 Câu trả lời
是的,您需要为特定通知注册您的 viewController
,例如,在您收到远程通知的情况下,只需发布自定义通知并在您的 viewController 中注册此通知/收听此通知并执行您要执行的方法。
当你收到remoteNotification
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
[[NSNotificationCenter defaultCenter] postNotificationName:@"pushNotification" object:nil userInfo:userInfo];
}
Trong của bạn viewController.m
中为这个通知注册 viewcontroller
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushNotificationReceived) name:@"pushNotification" object:nil];
[super viewDidLoad];
}
接下来实现选择器
-(void)pushNotificationReceived{
// do your stuff
}
最后不要忘记在您的dealloc
方法中注销通知
-(void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
关于ios - AppDelegate 的 ViewController 内的 Preform 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15210678/
我有一个名为 Project 的实体。 public class Project { @EmbeddedId private ProjectID id; @Column(name="updated_a
他我正在将一个项目移动到 codeigniter 项目。在这个项目中,我在我的 url 中放置了一个 md5(id) http://example.com?hash=424bbf597a23a198b
AppDelegate 能否在收到推送通知后在 View Controller 中运行“功能”? 应用程序包含三个选项卡,第三个选项卡需要在应用程序收到推送通知时重新加载其 webview。 - (v
我有一组像这样的回调 void (*callbacks[n])(void* sender) 我想知道这些代码中哪一个执行得更快: //Method A void nullcallback(void*
我想知道多次 NSLog() 调用是否会影响应用程序性能或内存。有谁知道这样的事情吗? 我想在我的应用程序中的每个函数中放置一个 NSLog() 调用(很多),以便我可以看到崩溃后记录并跟踪问题。 谢
Tôi là một lập trình viên xuất sắc, rất giỏi!