diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 8ff62215c30f72..5e781f83cadc06 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -708,6 +708,7 @@ - (void)test011_ReadCachedAttribute XCTestExpectation * subscribeExpectation = [self expectationWithDescription:@"Subscription complete"]; NSLog(@"Subscribing..."); + __block void (^reportHandler)(NSArray * _Nullable value, NSError * _Nullable error); [device subscribeWithQueue:queue minInterval:2 maxInterval:60 @@ -715,10 +716,20 @@ - (void)test011_ReadCachedAttribute cacheContainer:attributeCacheContainer attributeReportHandler:^(NSArray * value) { NSLog(@"Received report: %@", value); + if (reportHandler) { + __auto_type handler = reportHandler; + reportHandler = nil; + handler(value, nil); + } } eventReportHandler:nil errorHandler:^(NSError * error) { NSLog(@"Received report error: %@", error); + if (reportHandler) { + __auto_type handler = reportHandler; + reportHandler = nil; + handler(nil, error); + } } subscriptionEstablished:^() { [subscribeExpectation fulfill]; diff --git a/src/darwin/Framework/CHIPTests/MTRTestKeys.m b/src/darwin/Framework/CHIPTests/MTRTestKeys.m index bd02ead6083cd3..365646bc84a59d 100644 --- a/src/darwin/Framework/CHIPTests/MTRTestKeys.m +++ b/src/darwin/Framework/CHIPTests/MTRTestKeys.m @@ -18,8 +18,8 @@ #import @interface MTRTestKeys () -@property (readwrite) SecKeyRef privateKey; -@property (readwrite) SecKeyRef publicKey; +@property (readonly) SecKeyRef privateKey; +@property (readonly) SecKeyRef publicKey; @end @implementation MTRTestKeys @@ -79,11 +79,6 @@ - (NSData *)signMessageECDSA_DER:(NSData *)message return (__bridge_transfer NSData *) outData; } -- (SecKeyRef)publicKey -{ - return _publicKey; -} - - (void)dealloc { if (_publicKey) { diff --git a/src/darwin/Framework/CHIPTests/MTRThreadOperationalDatasetTests.mm b/src/darwin/Framework/CHIPTests/MTRThreadOperationalDatasetTests.mm index f067b188c7888d..894478eecae035 100644 --- a/src/darwin/Framework/CHIPTests/MTRThreadOperationalDatasetTests.mm +++ b/src/darwin/Framework/CHIPTests/MTRThreadOperationalDatasetTests.mm @@ -44,7 +44,7 @@ - (void)testThreadOperationalDataset channel:25 panID:[NSData dataWithBytes:&panID length:sizeof(panID)]]; XCTAssertNotNil(dataset); - NSData * data = [dataset asData]; + NSData * data = [dataset data]; XCTAssertNotNil(data); MTRThreadOperationalDataset * reconstructed = [[MTRThreadOperationalDataset alloc] initWithData:data];