Skip to content

Commit

Permalink
Fixing sending of variables back to Unity
Browse files Browse the repository at this point in the history
  • Loading branch information
milos1290 committed Dec 20, 2023
1 parent 018ca20 commit 9f4fb98
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions CleverTap/Plugins/iOS/CleverTapUnityManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -946,14 +946,7 @@ - (void)defineVar:(NSString *)name kind:(NSString *)kind andDefaultValue:(NSStri
}

[var onValueChanged:^{
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:[var value] options:0 error:&error];
if (!jsonData) {
NSLog(@"CleverTap: Error converting to JSON: %@", error);
return;
}
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
[self callUnityObject:kCleverTapGameObjectName forMethod:kCleverTapVariableValueChanged withMessage:jsonString];
[self callUnityObject:kCleverTapGameObjectName forMethod:kCleverTapVariableValueChanged withMessage:[var name]];
}];
}

Expand Down

0 comments on commit 9f4fb98

Please sign in to comment.