Re: C callbacks with NSNotificationCenter?
Re: C callbacks with NSNotificationCenter?
- Subject: Re: C callbacks with NSNotificationCenter?
- From: Jonathan Mitchell <email@hidden>
- Date: Wed, 07 Sep 2016 17:58:01 +0100
> Of course, I can't use this code in a normal C function because there are
> references to "self" and the selector thing doesn't look like it's compatible to
> C. So I could just subclass AVPlayerItem and voila, everything's fine.
I forgot to say that as long as your c function is in a .m file you can create and manipulate Obj-C objects freely.
void testNsObjectInCfunc() {
NSString *q = @"Am I alive";
}
Self is just a pointer to an object so within your c Functions you can cast it to the right type and call methods etc at will.
Obj-C methods are C functions that receive self as a parameter.
Note that using the CF objects is generally more of a challenge than using NSObject objects.
Jonathan
_______________________________________________
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