Questions tagged [addobserver]

64 questions
0
votes
1 answer

Objective-c - syntax for addObserver that returns a boolean value

I am trying to add an sdk call to my Xcode project, and in their documentation, they say: "If you are using these API's you can become an observer for the following events: NOTIFICATION_COMPLETED True/False - mail has completed with…
0
votes
1 answer

Android java.lang.IllegalStateException: Method addObserver must be called on the main thread

In my recent app version, I am seeing a lot of logs related to this issue: java.lang.IllegalStateException: Method addObserver must be called on the main thread…
0
votes
0 answers

addObserver with context to multiple collectionView

I have a controller that has multiple collectionView on it and I want to scroll as one. So I added an .addObserver to the collectionViews but I had issues with differentiating the two collectionViews so I added a context. My question is if this is…
Max
  • 93
  • 1
  • 6
0
votes
1 answer

When adding observer to the UIView causes memory leak in xamarin iOS

I prepared a custom control to enter numeric values and in my control loading I added a observer to get the device orientation change like in the below code snippet. Foundation.NSNotificationCenter.DefaultCenter.AddObserver(new…
0
votes
3 answers

How to specify notificationSender? (Cocoa Touch)

All of the examples I can find of setting up a notification look like this: [nc addObserver:self selector:@selector(keyboardWillShow:) name: UIKeyboardWillShowNotification object:nil]; where object is always being set to nil. object is the…
janineanne
  • 585
  • 7
  • 17
0
votes
1 answer

Selector function not being entered when observer is added

In my first view controller, I post the notification with the following code: NotificationCenter.default.post(name: Notification.Name("date"), object: formattedDate) I then "receive" the notification in a second view controller with the following…
Mvdm
  • 3
  • 2
0
votes
3 answers

iOS NotificationCenter unexpected retained closure

In the documentation, it says: The block is copied by the notification center and (the copy) held until the observer registration is removed. And it provides a one-time observer example code like so: let center =…
funct7
  • 3,407
  • 2
  • 27
  • 33
0
votes
1 answer

NSNotification, addObserver and removeObserver - removeObserver both in ViewDidUnload and dealloc?

I want to add a view controller as observer of a notification. When the selector method is called, I'll alert the user. I would that this alert appears only when this view controller is the top view controller. I thought to add it as observer in…
Sefran2
  • 3,578
  • 13
  • 71
  • 106
0
votes
2 answers

Adding an observer to a UITextfield. never fires?

Swift 4.0 iOS 11.x Added some UITextfields, became the first responder and than these observers. But they never seem to fire? What am I missing here? @IBOutlet weak var nameTextField: UITextField! @IBOutlet weak var hintTextField:…
0
votes
3 answers

How to restrict NSNotification to call methods multiple times in iOS?

I am using NSNotificationCenter to send local notifications in my code and working in both Objective-C and Swift. I'm posting notifications from Objective-C And receiving in Swift. But the methods that I added in notification getting called…
iVJ
  • 61
  • 1
  • 1
  • 13
0
votes
1 answer

Observing object using proxy object

Should I be able to set up an observer on a proxy object, change what the proxy object is pointing to and still be able to observe changes on the real object? An example might explain this best. Consider the following. In the header: @interface…
Hooligancat
  • 3,588
  • 1
  • 37
  • 55
0
votes
2 answers

Add an obsrver to an NSArrayController

I want to make an addObserver to my NSArraycontroller. The idea is that if an record from Core Data ( bind to the NSArrayController ) is changes the record get's saved to the sqlite database. The NSArraycontroller is bind to an NSTableView.
0
votes
2 answers

exception says sent to an object that is not KVC-compliant for the "frame" property

Inside my custom UITableViewCell I am doing something like this. -(void)checkHeight { if (self.frame.size.height < self.expandedHeight) { self.lblReasontitle.hidden=YES; } else { self.lblReasontitle.hidden=NO; …
Irrd
  • 325
  • 1
  • 6
  • 18
0
votes
1 answer

What is the correct way to listen for item selection in NSArrayController via NSNotificationCenter.defaultCenter() in Swift 2.1

I have a NSCollectionView populated using binding via NSArrayController. All i am trying is to add an observer to either NSArrayController or NSCollectionView so that when ever the selection changes i got a call a function. For example this is what…
0
votes
1 answer

where to addObserver in iOS

I use Objective-C to develop an iOS tabBar app. When users open the app, it is in tab1. When users click a picture in tab1, the app will jump to tab3 with the picture's name. The problem is where to call addObserver in tab3 since tab3 never opens?
Miken
  • 35
  • 8