blocks and NSInvocation question
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