I am trying to write a demo according to Thread Programming Guide about run loops.
When I implement NSPortDelegate’s - (void)handlePortMessage:(NSPortMessage *)portMessage; method it prompts an error:
Receiver type ‘NSPortMessage’ for instance message is a forward declaration
So I try to import by “Foundation/NSPortMessage.h”, after which it says:
Foundation/NSPortMessage.h file not found.
So I wonder whether we can use NSPortMesssage in iOS?
NSPortMessagedoesn’t seem to be in the iOS documentation so is presumably a private API. Xcode does code completion ofNSPortMessagefor me when I try to use it, presumably because of the forward declaration. However, if I ask Xcode to show me the definition ofNSPortMessageit says the symbol is not found which would confirm that it is a private API.The class exists in the Objective-C Runtime on my iPhone 4s so it is on the device. However
NSPortMessageallows inter-process communication which I assume would be against the iOS sandboxing security. Perhaps it will work for inter-thread communications though.I certainly wouldn’t try and use it in an app that is intended for the App Store.