I created a macOS app, added an XPC service target, and also added a source editor extension.
in The source editor extension‘s perform function. It doesn't work
- (void)performCommandWithInvocation:(XCSourceEditorCommandInvocation *)invocation completionHandler:(void (^)(NSError * _Nullable nilOrError))completionHandler {
self.xpcConnect = [[NSXPCConnection alloc] initWithServiceName:@"test.TestNewXPCApp.NewXPC"];
NSXPCInterface *interface = [NSXPCInterface interfaceWithProtocol:@protocol(NewXPCProtocol)];
self.xpcConnect.remoteObjectInterface = interface;
[self.xpcConnect resume];
[[self.xpcConnect remoteObjectProxy] performCalculationWithNumber:@231 andNumber:@119 withReply:^(NSNumber *reply) {
// We have received a response.
NSLog(@"ui success%@", reply);
}];
But In ViewControler.m, executing the same code , it can work.
So why is it possible to connect to the XPC service from within the macOS app, but not from the source editor extension?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I am very happy after I buy m1 pro mac. But now I am disappointed.
My project is huge project. When I use 2019 mac pro(16g)+ macos big sur + xcode 12.6 to run my project, it is normal.
But on m1 pro(32g) + macos monterey + xcode13, xcode offen show loading loading loading!
xcode offen stuck five second when two files tab switch(ram about 20g,not full). It is unbelievable! I can't endure it!
I think it is because macos monterey problem! When my 2019 mac pro upgrade to macos monterey, it has the problem! But I change to macos big sur, it is ok! But my new m1 pro can't change to the big sur. And I buy two m1 pro macpro, both have the same problem!
I need apple pay attention to this problem!I have buy two m1 pro mac, I decide to return sales!