You're right, eskimo. I applied XPC to my program. it is more simple than any other IPC.
Post
Replies
Boosts
Views
Activity
The reason is that *the container app is a monitor app to watch the status of the System Extension. For example, grab RX, TX, connection status periodically. Thereby It isn't System Extension try to communicate to container app but container app has to know what's happing in System Extension.
The details as below:
My App have to monitoring the status of Network Extension which is running in System Extension.
For the purpose I was used IPC (Unix Domain Socket with App Group) to communicate with Network Extensions.
After move over Network Extension from App Extension to System Extension IPC(Unix Domain Socket) doesn't work anymore.
Because [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:]
which was i called in my program that returns a path under /var/root
It means the Container App has no way to create or access sun_path
that indicate to the path under /var/root
So, I did my homework and found that processes can communicate through Darwin Notification Center.
But userInfo ignored. I'm back to square one.
I try to use XPC. I saw in simple firewall example. Or, Is there a way more simple than XPC?
I was trying to connect a socket(CFSocket) to other socket(A plain socket) that is for that connect to the server directly to receive data. Because there is core module written in C that used in many cross platform. In initial design time, I have no idea to connect them.
But as you pointed out, it is not necessary. a kind of misuse.
Can you tell me that another technique that doesn't depend on Run Loop?
I always love to learn new techniques.
Thank You.
Thank you Matt.
But It's a little bit weird to me. Maybe I am misunderstanding.
If Network Extension run inside App Extension, It's working fine. The Run Loop is running normally.
I already confirmed it. Before I try to distribute the app with System Extension I was developing the app with Network Extension which is running in App Extension.
I assumed that the Run Loop is running asynchronously in Network Extension which inside App Extension. If Network Extension reside in System Extension, the Run Loop is running synchronously. Is that possible?
Yes, You are right. It's my bad.
The suspect was not the codesign.
I am using socketpair()
to monitoring what's going on in uTun .
The code as below.
	CFSocketContext socketCtx = {0, (__bridge void *)context, NULL, NULL, NULL};
	tunnelSideSock = CFSocketCreateWithNative(kCFAllocatorDefault, socks[UTUN_SIDE], kCFSocketDataCallBack|kCFSocketReadCallBack|kCFSocketWriteCallBack, callback, &socketCtx);
CFRunLoopSourceRef tunSocketSource = CFSocketCreateRunLoopSource(kCFAllocatorDefault, tunnelSideSock, 0);
CFRunLoopAddSource(CFRunLoopGetMain(), tunSocketSource, kCFRunLoopDefaultMode);
CFRelease(tunSocketSource);
After I post the question, I had printed a lot of debug message in my code.
Then I found that CFRunLoop seems to which doesn't work correctly. It has to call the callback function when these events kCFSocketDataCallBack, kCFSocketReadCallBack, kCFSocketWriteCallBack
are getting hit.
But nothing happed.
My code run a main loop infinitely (But it is interruptable). Is it possible to block the CFRunLoop's main loop?
Finally, I figure out that how to attach Debugger to the process. Thank You.
Thank You. Again
I was thinking it is necessary. I did as you said, deleted it and NOTARIZED the app it works.
But I got other problems.
You save my life!
The problem solved!