问题标签 [nsnotification]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ios - 在 iOS4 中使用 MPMoviePlayerController 向前/向后搜索的问题
我对 iOS 中的 MPMoviePlayerController 有一个奇怪的问题。
我有一个没有控制风格的 MPMoviePlayerController。添加了我自己的 UISlider 以在电影中向前/向后搜索。
设置通知以查看播放状态的变化。
将 player.currentPlaybackTime 设置为新值后,播放状态将变为 MPMoviePlaybackStateSeekingForward 或 MPMoviePlaybackStateSeekingBackward 并保持在该状态。
我希望当搜索停止(找到新位置)并且播放器继续正常播放时,播放状态会回到 MPMoviePlaybachStatePlaying 但它不会。
这是正常行为还是我错过了什么?
objective-c - NSNotifications 的开销
我最近开始使用NSNotification
s:
我发现它对于视图控制器之间的通信来说是一个很棒的概念。NSNotification
对于应用程序中的所有通信,使用 s似乎有点太容易了。
如果我NSNotification
在我的应用程序中使用 s 来完成大部分工作,您认为其中太多的开销是多少?
cocoa-touch - NSNotification 导致分段错误
我对 NSNotification 对象有一个奇怪的行为。
我的应用程序有一个导航控制器,第一个视图是一个表格视图,第二个视图只是一个显示所选单元格数据的视图控制器。
所以在这个数据视图控制器中,当我按下按钮时会发送通知。该通知最初也有效。
但是当我返回表格视图并再次将数据视图控制器推送到堆栈上并触摸带有通知的按钮时,整个应用程序崩溃而没有错误日志。
Xcode 仅突出显示这一行:
我发送通知的功能:
这是接收器:
编辑:现在我确实得到了一些错误日志。
objective-c - 使用 NSNotificationCenter 向另一个类发送通知
所以我的目标是使用 using 将通知传递给另一个类NSNotificationCenter
,我也想将object
通知传递给 other class
,我应该怎么做?
objective-c - 将 NSNotification 从 classA 发送到 classB
所以我有一个应用程序内购买的应用程序。In App 购买在 FirstViewController 中进行管理。当用户购买了产品后,我想向我的 MainTableViewController 发送通知以重新加载表格数据并显示在应用内购买中购买的新对象。所以基本上我想从 A 类向 B 类发送通知,然后 B 类重新加载 tableview 的数据。我曾尝试使用 NSNotificationCenter,但没有成功,但我知道它可能与 NSNotificationCenter 一起使用,我只是不知道如何。
ios - 应用程序关闭时的 NSUserDefaultsDidChangeNotification
我正在开发的应用程序将用户信息存储在设置包中,以便与网络服务同步。我能够使用 NSUserDefaultsDidChangeNotification 通知成功检测到更改,但仅在应用程序处于后台时。如果我完全关闭应用程序并再次启动它不会收到该通知。我知道系统在后台合并应用程序的通知,但是在应用程序最初启动时有什么方法可以接收?如果没有,有没有好的解决方法?谢谢
objective-c - NSApplicationWillTerminateNotification 不起作用
我的问题是NSApplicationWillTerminateNotification
当我退出我的应用程序时没有调用。我尝试过的:(appDelegate.m)
或者
我的应用程序没有窗口,因为它是一个后台应用程序 -> 我删除了界面生成器中的窗口和菜单。
iphone - NSNotification 无处不在吗?
我正在使用以下方式发送通知:
并使用以下方式接收通知:
那么选择器中的方法就是:
由于某种原因,通知没有通过。可以从应用程序的任何位置发送和接收通知吗?
ios - How to prevent cheaters beating NSDate for iPhone games?
I'm currently playing around with NSNotification (or local notifications in general terms) for a product management game which relies heavily upon the user's NSDate/Time and then use local notifications to give an alert for when a product is ready.
However, in my experiments with similar games one can beat this system by simply moving the system clock forward and thus speed up the game.
I've noticed some games have stopped this, but I think thy did it by having an internal clock which syncs with an online clock and never uses the iPhone's clock, but this is just a guess as obviousily such a system doesn't work if you have no internet access.
Anyway, and am hopeful someone who has gone down this road can clarify;
Whether local notifications (or push notifications) are mature enough by themselves for games that rely on a users NSDate/Time?
How to prevent users/cheaters beating NSNotification/NSDates for games?
Is there an article or framework, or something that can explain the best methodologies on this subject?
I found Similar question for Virtual Pet Games, but I am still interested in other suggestions.
cocoa - KVO 观察 vs NSNotificationCenter 观察
我想知道是否有理由在 KVO vs NSNotificationCenter 观察中使用一个。性能、内存使用、速度等?