@@ -529,7 +529,7 @@ @implementation RNSensorsAnalyticsModule
529529/* *
530530 * 导出 getDistinctIdPromise 方法给 RN 使用.
531531 * <p>
532- * 删除当前这个用户的所有记录 .
532+ * Promise 方式,获取 distinctId .
533533 * <p>
534534 * RN 中使用示例:
535535 * async getDistinctIdPromise() {
@@ -555,7 +555,7 @@ @implementation RNSensorsAnalyticsModule
555555/* *
556556 * 导出 getAnonymousIdPromise 方法给 RN 使用.
557557 * <p>
558- * 删除当前这个用户的所有记录 .
558+ * Promise 方式 getAnonymousId 获取匿名 ID .
559559 * <p>
560560 * RN 中使用示例:
561561 * async getAnonymousIdPromise() {
@@ -570,5 +570,64 @@ @implementation RNSensorsAnalyticsModule
570570 }
571571}
572572
573+ /* *
574+ * 导出 registerSuperProperties 方法给 RN 使用.
575+ *
576+ * @param properties 要设置的公共属性
577+ *
578+ * RN 中使用示例:设置公共属性 "Platform":"iOS")
579+ * <Button
580+ * title="Button"
581+ * onPress={()=>
582+ * RNSensorsAnalyticsModule.registerSuperProperties({"Platform":"iOS"})}>
583+ * </Button>
584+ */
585+ RCT_EXPORT_METHOD (registerSuperProperties:(NSDictionary *)properties){
586+ @try {
587+ [[SensorsAnalyticsSDK sharedInstance ] registerSuperProperties: properties];
588+ } @catch (NSException *exception) {
589+ NSLog (@" [RNSensorsAnalytics] error:%@ " ,exception);
590+ }
591+ }
592+
593+ /* *
594+ * 导出 unregisterSuperProperty 方法给 RN 使用.
595+ *
596+ * @param property 要设置的公共属性
597+ *
598+ * RN 中使用示例:(删除公共属性 "Platform")
599+ * <Button
600+ * title="Button"
601+ * onPress={()=>
602+ * RNSensorsAnalyticsModule.unregisterSuperProperty("Platform")}>
603+ * </Button>
604+ */
605+ RCT_EXPORT_METHOD (unregisterSuperProperty:(NSString *)property){
606+ @try {
607+ [[SensorsAnalyticsSDK sharedInstance ] unregisterSuperProperty: property];
608+ } @catch (NSException *exception) {
609+ NSLog (@" [RNSensorsAnalytics] error:%@ " ,exception);
610+ }
611+ }
612+
613+ /* *
614+ * 导出 clearSuperProperties 方法给 RN 使用.
615+ *
616+ *
617+ * RN 中使用示例:(删除所有已设置的公共属性)
618+ * <Button
619+ * title="Button"
620+ * onPress={()=>
621+ * RNSensorsAnalyticsModule.clearSuperProperties()}>
622+ * </Button>
623+ */
624+ RCT_EXPORT_METHOD (clearSuperProperties){
625+ @try {
626+ [[SensorsAnalyticsSDK sharedInstance ] clearSuperProperties ];
627+ } @catch (NSException *exception) {
628+ NSLog (@" [RNSensorsAnalytics] error:%@ " ,exception);
629+ }
630+ }
631+
573632@end
574633
0 commit comments