1

Overview:

  • I am copying an instance of UILocalNotification and making changes to it to the newly created instance
  • Then I schedule the newly created instance of UILocalNotification

How I am copying

  • I am copying the instance of UILocalNotification by invoking the method copy

Question

  1. Am I doing the correct thing or should I be using a different method to create a mutable copy. (mutableCopy is not implemented for UILocalNotification
  2. Does copy actually do a mutable copy ?
  3. Is it necessary to create a copy at all, will scheduleLocalNotification: create a new copy anyway ?
user1046037
  • 16,755
  • 12
  • 92
  • 138

1 Answers1

3
  1. Yes, copy's fine.
  2. mutableCopy generally applies to types which distinguish immutable and mutable flavors. since the type does not make that distinction, copy is 'mutable'.
  3. typically, you would assume that you should need to copy the argument. in this case, the docs specify that scheduleLocalNotification: creates a copy of the parameter. explicitly copying is not strictly necessary.
justin
  • 104,054
  • 14
  • 179
  • 226
  • thank you so much Justin !! well explained if you have the time I have one more doubt - http://stackoverflow.com/questions/10359024/uilocalnotification-repeatinterval-reset-no-repeat – user1046037 Apr 28 '12 at 03:28