• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Preserving undo actions on deleted targets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preserving undo actions on deleted targets


  • Subject: Re: Preserving undo actions on deleted targets
  • From: Jerry Krinock <email@hidden>
  • Date: Thu, 30 Jan 2014 21:13:41 -0800

On 2014 Jan 30, at 18:15, Graham Cox <email@hidden> wrote:

> I believe this usage is safe (for now), but certainly if a cleaner solution can be found that would be great,

Yesterday before I convinced myself that this was a non-issue, I tried the following code:

+ (void)load {
   SEL aSEL = NSSelectorFromString(@"_processEndOfEventNotification:") ;
   class_addMethod(self, aSEL, (IMP) doNothingIMP, "@@:@");
}

void doNothingIMP(id self, SEL _cmd) {
	NSLog(@"Nothing doing!");
}

I tested it twice (saving a document), and it worked.  That is, it logged "Nothing doing!” (3 times for each save) and raised no exceptions.

Note that I’m referencing _processEndOfEventNotification: as a string instead of @selector().  I agree with Quincey’s implication that a string seems less likely to raise App Store Hackles than a @selector(), but truly we’re all just guessing.

On 2014 Jan 30, at 11:20, Kyle Sluder <email@hidden> wrote:

> we've been rejected for merely *referencing* verboten selectors

What do you mean by that, Kyle?  In a string?  @selector()?

Y’all know that one could go further and obfuscate the string @"_processEndOfEventNotification:”, by breaking it up into several pieces, reversing it, etc., and ultimately reconstructing it into a mutable string.  You have to be tricky enough to outwit the compiler, which will optimize out anything which is too boneheaded.  But it can be done.

Again, in my opinion, none of this is necessary because either the string or the SEL is OK, as is Graham's original code.  But I appreciate that preventing the issue with trickery is way better than spending hours to “win” a legal battle.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Preserving undo actions on deleted targets
      • From: Jerry Krinock <email@hidden>
References: 
 >Preserving undo actions on deleted targets (From: Matthew LeRoy <email@hidden>)
 >Re: Preserving undo actions on deleted targets (From: Jerry Krinock <email@hidden>)
 >Re: Preserving undo actions on deleted targets (From: Keary Suska <email@hidden>)
 >Re: Preserving undo actions on deleted targets (From: Graham Cox <email@hidden>)
 >Re: Preserving undo actions on deleted targets (From: glenn andreas <email@hidden>)
 >Re: Preserving undo actions on deleted targets (From: Graham Cox <email@hidden>)
 >Re: Preserving undo actions on deleted targets (From: Quincey Morris <email@hidden>)
 >Re: Preserving undo actions on deleted targets (From: Graham Cox <email@hidden>)
 >Re: Preserving undo actions on deleted targets (From: Quincey Morris <email@hidden>)
 >Re: Preserving undo actions on deleted targets (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Preserving undo actions on deleted targets
  • Next by Date: Re: Preserving undo actions on deleted targets
  • Previous by thread: Re: Preserving undo actions on deleted targets
  • Next by thread: Re: Preserving undo actions on deleted targets
  • Index(es):
    • Date
    • Thread