• 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
Accessing class/instance methods from USB callback?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing class/instance methods from USB callback?


  • Subject: Accessing class/instance methods from USB callback?
  • From: Juan Pablo Pertierra <email@hidden>
  • Date: Wed, 11 May 2005 22:08:47 -0500

I'm having some trouble in my cocoa app, I am calling USB Async functions which have Standard-C callbacks.

I want the USB callback function to trigger a method in MyController class. So, when I call the AsyncRead, i pass an argument to the callback function, which contains a pointer to MyController instance. Then, I use [(MyController*)arg myMethod] to trigger the method from the C callback function.

However, this only seems to work if I define myMethod as a class method. If I define it as an instance method then I get an error:
+[MyController myMethod]: selector not recognized


If I make it a class method, then it gets called but I can't access the instance variables I need from the MyController instance, which is the whole reason i'm calling a method of MyController in the first place.

So, I guess this can be solved in two ways: How can I use an instance method instead of a class method from the C callback? Or, how can I access an instance variable from a class method?

Thanks,
Juan

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Accessing class/instance methods from USB callback?
      • From: Cameron Hayne <email@hidden>
  • Prev by Date: NSBindingDebugLogLevel for helping diagnose problems with Bindings?
  • Next by Date: Smooth scrolling
  • Previous by thread: NSBindingDebugLogLevel for helping diagnose problems with Bindings?
  • Next by thread: Re: Accessing class/instance methods from USB callback?
  • Index(es):
    • Date
    • Thread