Questions tagged [nsnotification]

NSNotification is a class used to send messages to observing classes through NSNotificationCenter.

NSNotification is a class used to send messages to observing classes through NSNotificationCenter. Notifications must have a name and can be optionally associated with a specific object. If an object is provided, the notification is only delivered to a class that is also observing the exact same name and object.

To send a notification, use NSNotificationCenter's postNotification: (a convenience function postNotificationName:object:userInfo: also exists which creates a notification and posts it with a single call). Classes posting a notification can also include an optional userInfo parameter to pass an object to the receiving class.

For more information, see Apple's documentation for NSNotification and NSNotificationCenter.

312 questions
0
votes
1 answer

Delivering data between two viewControllers via “NSKeyedArchiver ” causes double “import” error?

I am a new iOS developer. These days, I have been stuck in a problem : delivering data between two viewControllers via “NSKeyedArchiver ” causes double “import”, by which I mean both the two viewControllers import each other.
Min Wang
  • 305
  • 4
  • 16
0
votes
1 answer

Specifying different images to use for a UIPageViewController called programatically

I am building up a pretty straight forward app, but I'm having a bit of difficulty actually with one concept. I have a UITableViewController with 15 static cells, each with a different language. When I click on a language, I am modally and…
0
votes
1 answer

iOS - pass int between view controllers

I have an int pageNumber setup like so @property (nonatomic, assign) int pageNumber; which I am trying to pass between two view controllers. It works the first time I tap a cell in the tableview, however if I tap a cell again the int does not get…
0
votes
2 answers

Correct way to use UITextViewTextDidBeginEditingNotification

I have a UITextView and I can't seen to get the NSNotification of UITextViewTextDidBeginEditingNotification to work. I am implementing it almost the exact same as I implement the similar NSNotification for a UITextField. Here is my code to set up…
Cocorico
  • 2,319
  • 3
  • 22
  • 31
0
votes
2 answers

Dispatch group and NSNotification

My issue is simple. I have 3 tasks, one is triggered by an NSNotification. How to I wait for all task to be completed before proceeding. So far, I tried using dispatch group but can't find a way to add the task triggered by NSNotification. (I tried…
0
votes
0 answers

Can't get movie to finish within loop

I want a movie to play as often as there are objects in an array, but I want to make sure that the movie has finished playing each time. Here's some -simplified- code that I'd expect to do just that: - (void)loopThroughArray { [Array…
Sjakelien
  • 2,255
  • 3
  • 25
  • 43
0
votes
1 answer

Why is my NSNotificationCenter throwing an exception?

I have a table view controller with a swipe gesture recognizer that fires NSNotificationCenter.defaultCenter().postNotificationName("DuskTheme", object: nil) whenever the user swipes up. In the viewDidLoad() function, I have the following observer:…
cyril
  • 3,020
  • 6
  • 36
  • 61
0
votes
1 answer

Tableview reload data problem iphone sdk

I have a class A which is a subclass of uitableviewcontroller and one more class B which actually displays my tableview with its content is a subclass of A. There's an xml parser which parses my xml and stores the content in an nsmutablearray of…
neha
  • 6,327
  • 12
  • 46
  • 78
0
votes
2 answers

Could not find an overload for 'subscript' that accepts the supplied arguments

func keyboardDidShow(notification:NSNotification) { var info = notification.userInfo var keyboardHeight: CGFloat = (info[UIKeyboardFrameBeginUserInfoKey] as! NSValue).CGRectValue().size.height constraintScrollViewBottomSpace.constant =…
PK86
  • 1,218
  • 2
  • 14
  • 25
0
votes
2 answers

Kiwi spying on multiple NSNotifications

I am currently spying on postNotification like this __block KWCaptureSpy *notificationSpy = [[NSNotificationCenter defaultCenter] captureArgument:@selector(postNotification:) atIndex:0]; The problem is I have multiple notifications with different…
Vig
  • 1,532
  • 1
  • 12
  • 28
0
votes
1 answer

Removing an AdBannerView from a UIViewController from an IAP without having to restart the app

I have a 5-tab UITabBarController where each Tab is a UIViewController. The first tab is called Timeline, the second is called Person and the last tab is called More. I have implemented In-App Purchases with my app where before the IAP, the user…
amitsbajaj
  • 1,304
  • 1
  • 24
  • 59
0
votes
0 answers

NSNotification argument in NSNotificationCenter method is nil

I have this really unexplained problem with NSNotification method. I have been using NSNotificationCenter for a long time but i can't explain why this is happening. My problem is this, I have a UITableViewCell subclass where i send a…
YYfim
  • 1,402
  • 1
  • 9
  • 24
0
votes
2 answers

Listening for NSNotifications in an NSOperation subclass?

I'm writing an app where I've got a long running server-syncronization task running in the background, and I'd like to use NSOperation and NSOperationQueue for this. I'm leaning this way, since I need to ensure only one synchronisation operation is…
Darren Black
  • 1,030
  • 1
  • 9
  • 28
0
votes
4 answers

AVPlayerItemDidPlayToEndTimeNotification only works if forced

I been searching everywhere and I still can't find a solution to this problem. I have a AVQueuePlayer for a radio app that I am making. It has about 20 AVPlayerItems queued at a time. I added the AVPlayerItemDidPlayToEndTimeNotification observer to…
Dhananjay Suresh
  • 1,030
  • 1
  • 14
  • 28
0
votes
0 answers

NSNotificationCenter debugging

i work with NSNotification and unfortunately i can not debug the selector. In my ViewController.m, in the viewdidload method i implement the NSNotifiaction call. Also in my ViewController.m I implement the selector. Unfortunately i can not debug the…
Fahem Issameddine
  • 293
  • 1
  • 2
  • 10