Skip to content

Commit 9ed3a35

Browse files
committed
ARKit.hitTestPlanes with ARKit.ARHitTestResultType.FeaturePoint
no longer throws error because of missing id
1 parent eaca043 commit 9ed3a35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ios/RCTARKitNodes.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ - (NSMutableArray *) mapHitResultsWithSceneResults: (NSArray<SCNHitTestResult *>
218218

219219

220220

221-
221+
static id ObjectOrNull(id object)
222+
{
223+
return object ?: [NSNull null];
224+
}
222225

223226
- (NSMutableArray *) mapHitResults:(NSArray<ARHitTestResult *> *)results {
224227
NSMutableArray *resultsMapped = [NSMutableArray arrayWithCapacity:[results count]];
@@ -230,7 +233,7 @@ - (NSMutableArray *) mapHitResults:(NSArray<ARHitTestResult *> *)results {
230233
SCNVector3 position = [self getRelativePositionToOrigin:positionAbsolute];
231234
[resultsMapped addObject:(@{
232235
@"distance": @(result.distance),
233-
@"id": result.anchor.identifier.UUIDString,
236+
@"id": ObjectOrNull(result.anchor.identifier.UUIDString),
234237
@"positionAbsolute": @{
235238
@"x": @(positionAbsolute.x),
236239
@"y": @(positionAbsolute.y),

0 commit comments

Comments
 (0)