• 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
blocks and NSInvocation question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

blocks and NSInvocation question


  • Subject: blocks and NSInvocation question
  • From: John Michael Zorko <email@hidden>
  • Date: Sun, 10 Apr 2011 21:53:22 -0700

Hello, all ...

I'm stumped as to why this generates a warning when I compile. Do I need to do something special with my AVURLAsset * to be able to access it from inside the block in order to add it to an NSInvocation?

    for (int index = 0; index < [assetsToLoad count]; index ++)
    {
        NSURL *streamURL = [assetsToLoad objectAtIndex:index];
        AVURLAsset *asset = [AVURLAsset URLAssetWithURL:streamURL options:nil];
        NSString *tracks = @"tracks";

        [asset loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:tracks] completionHandler:^
         {
             SEL sel = @selector(setupPlayerForAsset:withIndex:);
             NSMethodSignature *sig = [self methodSignatureForSelector:sel];
             NSInvocation *inv = [NSInvocation invocationWithMethodSignature:sig];
             NSNumber *invNumber = [NSNumber numberWithInt:index];
             [inv setTarget:self];
             [inv setSelector:sel];
             [inv setArgument:&asset atIndex:2];	// warning: passing argument 1 of 'setArgument:atIndex:' discards qualifiers from pointer target type



             [inv setArgument:&invNumber atIndex:3];
             [inv retainArguments];
             [inv performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:YES];
             [self performSelectorOnMainThread:sel withObject:asset waitUntilDone:YES];
         }];
        }
    }

Regards,

John

_______________________________________________

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: blocks and NSInvocation question
      • From: Ken Thomases <email@hidden>
  • Prev by Date: OCMock in Xcode 4
  • Next by Date: Re: file done writing?
  • Previous by thread: Re: OCMock in Xcode 4
  • Next by thread: Re: blocks and NSInvocation question
  • Index(es):
    • Date
    • Thread