0

How would you solve this? When the app starts, four objects of a class are created. These objects have names you know because you named them yourself. From a viewController you can access these objects and call a method (which they all got) which creates a UILocalNotification. (So in the end you've got four notifications running.)

Two questions:

  1. How do you name the notifications (differently)? As far as I know is it not possible to access the object name to use the string as name when creating the notification? (Which would be the best solution?)

  2. When the notifications are fired, how do you access/cancel them from another viewController when you don't know the names?

Thank you!

1 Answer 1

1

Set tags for all objects, and set same tags for notifications, they generate.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you! How would that look like? Could you maybe give me a code example?
in h-file: property(nonatomic) NSInteger tag; in method witch creates a notification: notification.tag = self.tag; in place where you create an object of your class: object.tag = 1;// unique int value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.