Skip to content

Commit 7f84a48

Browse files
authored
[Darwin] MTRDeviceController_XPC client protocol xpc interface fix (#35087)
1 parent 88b6644 commit 7f84a48

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm

+21-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@ @implementation MTRDeviceController_XPC
4343

4444
@synthesize uniqueIdentifier = _uniqueIdentifier;
4545

46+
- (NSXPCInterface *)_interfaceForClientProtocol
47+
{
48+
NSXPCInterface * interface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)];
49+
NSSet * allowedClasses = [NSSet setWithArray:@[
50+
[NSString class], [NSNumber class], [NSData class], [NSArray class], [NSDictionary class], [NSError class], [MTRAttributePath class]
51+
]];
52+
[interface setClasses:allowedClasses
53+
forSelector:@selector(device:receivedAttributeReport:)
54+
argumentIndex:1
55+
ofReply:NO];
56+
allowedClasses = [NSSet setWithArray:@[
57+
[NSString class], [NSNumber class], [NSData class], [NSArray class], [NSDictionary class], [NSError class], [MTREventPath class]
58+
]];
59+
[interface setClasses:allowedClasses
60+
forSelector:@selector(device:receivedEventReport:)
61+
argumentIndex:1
62+
ofReply:NO];
63+
return interface;
64+
}
65+
4666
- (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection * (^)(void) )connectionBlock
4767
{
4868
if (self = [super initForSubclasses]) {
@@ -64,7 +84,7 @@ - (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection
6484
if (self.xpcConnection) {
6585
self.xpcConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCServerProtocol)];
6686

67-
self.xpcConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)];
87+
self.xpcConnection.exportedInterface = [self _interfaceForClientProtocol];
6888
self.xpcConnection.exportedObject = self;
6989

7090
self.xpcConnection.interruptionHandler = ^{

0 commit comments

Comments
 (0)