Skip to content

Commit 84e8119

Browse files
author
Adam Schlesinger
committed
Match Android logic for pulling the first group match
1 parent 0b60af4 commit 84e8119

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

iOS_SDK/OneSignalSDK/Source/OneSignalRequest.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ -(void)attachBodyToRequest:(NSMutableURLRequest *)request withParameters:(NSDict
106106

107107
NSRegularExpression *eidRegex = [NSRegularExpression regularExpressionWithPattern:@"(?<=\"external_user_id\":\").*\\/.*?(?=\",|\"\\})" options:0 error:&error];
108108
NSArray *matches = [eidRegex matchesInString:requestString options:0 range:NSMakeRange(0, [requestString length])];
109-
for (NSTextCheckingResult *match in matches) {
109+
110+
if ([matches count] > 0) {
111+
NSTextCheckingResult *match = matches[0];
110112
NSString *matched = [requestString substringWithRange:[match range]];
111113
NSString *unescapedEID = [matched stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"];
112114
requestString = [requestString stringByReplacingOccurrencesOfString:matched withString:unescapedEID];

0 commit comments

Comments
 (0)