nsnotifications

NSUserDefaultsDidChangeNotification not sent when app resumes from the background

淺唱寂寞╮ 提交于 2019-12-02 07:57:50
Apple's documentation says that "the system queues many relevant notifications and delivers them to the app as soon as it starts executing code again (either in the foreground or background)", including NSUserDefaultsDidChangeNotification, but my app is not receiving it. Here's a log trace of relevant events: 2013-06-25 16:23:36.857 -[DPLAppDelegate applicationWillResignActive:] [debug]: end willResignActive 2013-06-25 16:23:36.859 -[DayViewController handlePreferenceChange:] [debug]: day controller received user defaults did change notification 2013-06-25 16:23:36.970 -[AppDelegate

Present another View Controller from SkScene

拟墨画扇 提交于 2019-12-02 07:08:09
I'm trying to present another viewController from my "SkScene". This is my main viewController (tuViewController) Code: -(void) openTweetSheet{ FacebookLikeViewDemoViewController *ctrl = [[FacebookLikeViewDemoViewController alloc] initWithNibName:@"FacebookLikeViewDemoViewController" bundle:nil]; [self presentViewController:ctrl animated:YES completion:nil]; } This is my "SkScene": tuViewController *viewController = [[tuViewController alloc]init]; [viewController openTweetSheet]; And the viewController which i want to present is FacebookLikeViewDemoViewController and i need to have way back to

MPMovieplayerController doesn't play next URL when in background

社会主义新天地 提交于 2019-12-02 05:26:36
问题 I am developing an iOS app in which I am streaming .mp3 files using MPMoviePlayerController. When playing of one file completes I take next url and play the file. All works great in foreground but when I move the app to background the current song plays well but when it finishes, the method which plays the next song doesn't get executed. I checked similar questions on stackoverflow but the solutions doesn't seem to work for me. Any pointer in the right direction will be very helpful. Thanks

who is issuing my UIKeyboardDidHideNotification?

亡梦爱人 提交于 2019-12-02 04:15:07
I want to register to UIKeyboardDidHideNotification that only my UIViewController is issuing. When I do : [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:self]; I'm not getting any calls to keyboardDidHide: and when I do : [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil]; I'm getting calls from all the other view controller as well as my own. How can I register to the UIKeyboardDidHideNotification raised only by a

Specifically detailing what defaults have changed on NSUserDefaultsDidChangeNotification

大兔子大兔子 提交于 2019-12-02 02:23:53
问题 I'm starting to get into the inner sanctum of NSUserDefaults to the point where I can now successfully intercept an NSUserDefaultsDidChangeNotification notification using a supplied selector plus NSNotification object as a parameter. However, the returned NSNotification object does not appear as I had expected. What I was expecting was: 1) Receive NSUserDefaultsDidChangeNotification from the notification centre. 2) Interrogate the returned supplied NSNotification object for user info

MPMovieplayerController doesn't play next URL when in background

家住魔仙堡 提交于 2019-12-01 23:00:31
I am developing an iOS app in which I am streaming .mp3 files using MPMoviePlayerController. When playing of one file completes I take next url and play the file. All works great in foreground but when I move the app to background the current song plays well but when it finishes, the method which plays the next song doesn't get executed. I checked similar questions on stackoverflow but the solutions doesn't seem to work for me. Any pointer in the right direction will be very helpful. Thanks in advance! EDIT :On testing the app on different devices I found that the functionality is working on

why do I get “wait_fences: failed to receive reply” for this code?

[亡魂溺海] 提交于 2019-12-01 11:05:10
why do I get "wait_fences: failed to receive reply" for this code? Is it the way I'm using notification to communicate back to the main thread? #import "ViewController.h" @implementation ViewController @synthesize alert; #pragma mark - Background Thread Test Methods - (void) ConfigTasksForBackground:(id)sender{ NSLog(@"ConfigTasksForBackground - Starting"); [NSThread sleepForTimeInterval:6]; [[NSNotificationCenter defaultCenter] postNotificationName:@"ModelChanged" object:self]; NSLog(@"ConfigTasksForBackground - Ending"); } #pragma mark - Callbacks - (void) ModelChangedHandler:(NSNotification

Can I watch an NSNotification from another class?

耗尽温柔 提交于 2019-12-01 05:24:43
I'm trying to get my head around NSNotificationCenter. If I have something like this in my App Delegate: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(something:) name:@"something" object:nil]; ----- -(void)something:(NSNotification *) notification { // do something } Can I somehow watch this in another view controller? In my case, I'd like to watch it in a view controller with a table, and then reload the table when a notification is received. Is this possible? Yes you can that is the whole purpose of NSNotification , you just have to add the View Controller you

Does NSFetchedResultsController Observe All Changes to Persistent Store?

自作多情 提交于 2019-12-01 04:12:17
My program does work like link below: Update results of NSFetchedResultsController without a new fetch show result of NSFetchedResultsController to UITableView get new object from web service and store it to core data (in same view controller, with RestKit) update table view with notification of NSFetchedResultsController delegate The implementation of NSFetchedResultsControllerDelegate is copied from Apple's Core Data project and my predicated is: [NSPredicate predicateWithFormat:@"isMyTest == TRUE"] If the property update goes from TRUE to FALSE, it removes rows from the tableview (because

How can I get notified of a system time change in my Cocoa application?

二次信任 提交于 2019-12-01 03:56:30
I have a Cocoa application that records datestamps on events. I need to know when the system time is reset and by how much, but I can't seem to fine a notification anywhere that tells me such a thing has happened. This change could happen because NTP reset the clock or because the user reset (e.g. from System Preferences). It would be great if there was just a NSNotification I could register to receive, but I'm open to any suggestions. Dave Gallagher Apple added in NSSystemClockDidChangeNotification , part of NSDate, in Snow Leopard (10.6). There doesn't appear to be a way to do it in Leopard