From 38510c4937b615f66e83167b4b808223268e19bd Mon Sep 17 00:00:00 2001 From: sheng <277715243@qq.com> Date: Wed, 3 Feb 2021 11:15:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E6=8E=89xcodebuild=20test?= =?UTF-8?q?=E7=9A=84os=E7=89=88=E6=9C=AC=E4=BE=9D=E8=B5=96,=E4=BF=AE?= =?UTF-8?q?=E6=94=B9ThreadTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- .../MethodTest/A1TrackAPIMainThreadTest.m | 472 ++++++++---------- GrowingAnalytics.podspec | 2 +- 3 files changed, 203 insertions(+), 273 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3a48df70..71c1c7329 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: oclint-json-compilation-database -e Pods -- -rc GIO_METHOD_ALLOW_UPPERCASE="URL,FMG3DB,TXT,UTF,STM,IMP" -rc GIO_CATEGORY_PREFIX=Growing -rc GIO_CLASS_PREFIX=Growing -max-priority-2=0 - name: Run Tests - run: xcodebuild test -workspace GrowingAnalytics.xcworkspace -scheme Example -destination 'platform=iOS Simulator,name=iPhone 12 Pro,OS=14.2' GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES + run: xcodebuild test -workspace GrowingAnalytics.xcworkspace -scheme Example -destination 'platform=iOS Simulator,name=iPhone 12 Pro' GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES - name: Upload coverage to Codecov if: always() diff --git a/Example/ExampleTests/MethodTest/A1TrackAPIMainThreadTest.m b/Example/ExampleTests/MethodTest/A1TrackAPIMainThreadTest.m index f18227301..eb5c31f33 100644 --- a/Example/ExampleTests/MethodTest/A1TrackAPIMainThreadTest.m +++ b/Example/ExampleTests/MethodTest/A1TrackAPIMainThreadTest.m @@ -14,6 +14,8 @@ #import "GrowingEventManager.h" #import +#import "GrowingSession.h" +#import "GrowingDispatchManager.h" @interface GrowingEventManager (GrowingAutoTest) @end @@ -21,7 +23,7 @@ @interface GrowingEventManager (GrowingAutoTest) @implementation GrowingEventManager (GrowingAutoTest) -static NSString *isMainThread = @"1"; +static NSString *isGrowingThread = @"1"; static NSMutableArray *originalEventArray = nil; static NSMutableArray *dbEventArray = nil; static GrowingBaseEvent *originalEvent = nil; @@ -32,7 +34,7 @@ + (void)load { dispatch_once(&onceToken, ^{ Class clazz = NSClassFromString(@"GrowingEventManager"); - NSDictionary *swizzleDic = @{@"handleEvent:":@"mainThreadHandleEvent:", @"writeToDatabaseWithEvent:":@"writeToDBWithEventTest:"}; + NSDictionary *swizzleDic = @{@"sendEventsOfChannel_unsafe:":@"sendEventsOfChannel_unsafeProxy:", @"writeToDatabaseWithEvent:":@"writeToDBWithEventTest:"}; for (NSString *key in swizzleDic) { @@ -62,21 +64,13 @@ + (void)load { }); } -- (void)mainThreadHandleEvent:(GrowingBaseEvent *)event { +- (void)sendEventsOfChannel_unsafeProxy:(id)channel { - originalEvent = event; - - [self mainThreadHandleEvent:event]; + [self sendEventsOfChannel_unsafeProxy:channel]; - if (!originalEventArray) { - originalEventArray = [NSMutableArray array]; - } - [originalEventArray addObject:event]; - - // 判断是否在主线程 - if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) != 0) { - // 非主线程 - isMainThread = @"0"; + // 判断是否在Growing线程 + if (![[NSThread currentThread].name hasPrefix:@"com.growing"]) { + isGrowingThread = @"0"; } } @@ -84,6 +78,7 @@ - (void)mainThreadHandleEvent:(GrowingBaseEvent *)event { // 判断入库事件带上 gesid 和 esid - (void)writeToDBWithEventTest:(GrowingBaseEvent *)event { + [self writeToDBWithEventTest:event]; if (!dbEventArray) { @@ -91,20 +86,18 @@ - (void)writeToDBWithEventTest:(GrowingBaseEvent *)event { } [dbEventArray addObject:event]; -} + // 判断是否在Growing线程 + if (![[NSThread currentThread].name hasPrefix:@"com.growing"]) { -- (NSArray *)getEventTypes { -// GrowingBaseEventManager *eventManager = [GrowingBaseEventManager shareInstance]; -// GrowingBaseEventCounter * eventCounter = [eventManager valueForKey:@"eventCounter"]; -// NSDictionary *eventTypeIdMap = [eventCounter valueForKey:@"eventSequenceIdMap"]; -// return eventTypeIdMap.allKeys; - return nil; + isGrowingThread = @"0"; + } } + @end -@interface A1TrackAPIMainThreadTest : KIFTestCase +@interface A1TrackAPIMainThreadTest : KIFTestCase @end @@ -112,6 +105,7 @@ @implementation A1TrackAPIMainThreadTest + (void)setUp { [super setUp]; + [[GrowingEventManager shareInstance] addInterceptor:self]; } + (void)tearDown { @@ -129,242 +123,247 @@ - (void)tearDown { [super tearDown]; } +#pragma mark - GrowingEventInterceptor + +- (void)growingEventManagerEventDidBuild:(GrowingBaseEvent *)event { + originalEvent = event; + if (!originalEventArray) { + originalEventArray = [NSMutableArray array]; + } + [originalEventArray addObject:event]; +} + #pragma mark -GrowingCoreKit API Test - (void)test1SetUserIdTest { - isMainThread = @"1"; + isGrowingThread = @"1"; // hook 入库方法,在 handleEvent: GrowingBaseEventManager // 设置一个变量进行判断 [[GrowingAutotracker sharedInstance] cleanLoginUserId]; XCTestExpectation *expectation = [self expectationWithDescription:@"setUserId: fail"]; dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] setLoginUserId:@"9"]; + NSString *userId = @"123456789"; + [[GrowingAutotracker sharedInstance] setLoginUserId:userId]; + [GrowingDispatchManager trackApiSel:_cmd dispatchInMainThread:^{ + XCTAssertEqual([GrowingSession currentSession].loginUserId,userId); + }]; [expectation fulfill]; }); - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 + [self waitForExpectationsWithTimeout:1 handler:^(NSError *error) { if (error) { NSLog(@"Test failed——%@",expectation.description); XCTAssertEqual(@"1", @"0"); } }]; - [self eventTest]; - } - (void)test2ClearUserIdTest { - isMainThread = @"1"; + isGrowingThread = @"1"; XCTestExpectation *expectation = [self expectationWithDescription:@"clearUserId: fail"]; dispatch_async(dispatch_get_global_queue(0, 0), ^{ [[GrowingAutotracker sharedInstance] cleanLoginUserId]; + [GrowingDispatchManager trackApiSel:_cmd dispatchInMainThread:^{ + XCTAssertEqual([GrowingSession currentSession].loginUserId,nil); + }]; [expectation fulfill]; }); - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { + [self waitForExpectationsWithTimeout:1 handler:^(NSError *error) { // 操作15秒超时,支持不通过 if (error) { NSLog(@"Test failed——%@",expectation.description); XCTAssertEqual(@"1", @"0"); } }]; - [self eventTest]; - } -- (void)test3SetEvarTest { - - isMainThread = @"1"; - XCTestExpectation *expectation = [self expectationWithDescription:@"setEvar: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] setConversionVariables:@{@"EvarAutoTest":@"evarAuto"}]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; +- (void)test3SetConversionVariablesTest { + isGrowingThread = @"1"; + XCTestExpectation *expectation = [self expectationWithDescription:@"setConversionVariables: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [[GrowingAutotracker sharedInstance] setConversionVariables:@{@"EvarAutoTest":@"evarAuto"}]; + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:2 handler:^(NSError *error) { + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + [self eventTest]; } - (void)test4SetEvarAndStringTest { + isGrowingThread = @"1"; + XCTestExpectation *expectation = [self expectationWithDescription:@"setEvarWithKey:andStringValue: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [[GrowingAutotracker sharedInstance] setConversionVariables:@{@"EvarKeyAutoTest":@"evarKeyAutoString"}]; + [expectation fulfill]; + }); - isMainThread = @"1"; - XCTestExpectation *expectation = [self expectationWithDescription:@"setEvarWithKey:andStringValue: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] setConversionVariables:@{@"EvarKeyAutoTest":@"evarKeyAutoString"}]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; - + [self waitForExpectationsWithTimeout:2 handler:^(NSError *error) { + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + [self eventTest]; } - (void)test5SetEvarAndNumberTest { - isMainThread = @"1"; - XCTestExpectation *expectation = [self expectationWithDescription:@"setEvarWithKey:andNumberValue: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] setConversionVariables:@{@"EvarNumberAutoTest" :@22}]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; + isGrowingThread = @"1"; + XCTestExpectation *expectation = [self expectationWithDescription:@"setEvarWithKey:andNumberValue: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [[GrowingAutotracker sharedInstance] setConversionVariables:@{@"EvarNumberAutoTest" :@22}]; + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { + // 操作15秒超时,支持不通过 + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + + [self eventTest]; } - (void)test6SetPeopleTest { - isMainThread = @"1"; - XCTestExpectation *expectation = [self expectationWithDescription:@"setPeopleVariable: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] setLoginUserAttributes:@{@"PeopleAutoTest":@"peopleAuto"}]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; + isGrowingThread = @"1"; + XCTestExpectation *expectation = [self expectationWithDescription:@"setPeopleVariable: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [[GrowingAutotracker sharedInstance] setLoginUserAttributes:@{@"PeopleAutoTest":@"peopleAuto"}]; + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { + // 操作15秒超时,支持不通过 + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + + [self eventTest]; } - (void)test7SetPeopleAndStringTest { - isMainThread = @"1"; - XCTestExpectation *expectation = [self expectationWithDescription:@"setPeopleVariableWithKey:andStringValue: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] setLoginUserAttributes:@{@"PeopleKeyAutoTest" :@"PeopleKeyAutoString"}]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; + isGrowingThread = @"1"; + XCTestExpectation *expectation = [self expectationWithDescription:@"setPeopleVariableWithKey:andStringValue: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [[GrowingAutotracker sharedInstance] setLoginUserAttributes:@{@"PeopleKeyAutoTest" :@"PeopleKeyAutoString"}]; + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { + // 操作15秒超时,支持不通过 + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + + [self eventTest]; } - (void)test8SetPeopleAndNumberTest { - isMainThread = @"1"; - XCTestExpectation *expectation = [self expectationWithDescription:@"setPeopleVariableWithKey:andNumberValue: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] setLoginUserAttributes:@{@"PeopleNumberAutoTest" :@22}]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; + isGrowingThread = @"1"; + XCTestExpectation *expectation = [self expectationWithDescription:@"setPeopleVariableWithKey:andNumberValue: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [[GrowingAutotracker sharedInstance] setLoginUserAttributes:@{@"PeopleNumberAutoTest" :@22}]; + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { + // 操作15秒超时,支持不通过 + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + + [self eventTest]; } - (void)test9TrackTest { - isMainThread = @"1"; - XCTestExpectation *expectation = [self expectationWithDescription:@"track: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] trackCustomEvent:@"TrackAutoTest"]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; + isGrowingThread = @"1"; + XCTestExpectation *expectation = [self expectationWithDescription:@"track: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [[GrowingAutotracker sharedInstance] trackCustomEvent:@"TrackAutoTest"]; + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { + // 操作15秒超时,支持不通过 + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + + [self eventTest]; } - (void)test10TrackAndNumberTest { - isMainThread = @"1"; - XCTestExpectation *expectation = [self expectationWithDescription:@"track:withNumber: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] trackCustomEvent:@"TrackAutoTest"]; - [[GrowingAutotracker sharedInstance] trackCustomEvent:@"TrackAutoTest"]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; + isGrowingThread = @"1"; + XCTestExpectation *expectation = [self expectationWithDescription:@"track:withNumber: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [[GrowingAutotracker sharedInstance] trackCustomEvent:@"TrackAutoTest"]; + [[GrowingAutotracker sharedInstance] trackCustomEvent:@"TrackAutoTest"]; + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { + // 操作15秒超时,支持不通过 + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + + [self eventTest]; } - (void)test11TrackAndNumberAndVariableTest { - isMainThread = @"1"; - XCTestExpectation *expectation = [self expectationWithDescription:@"track:withNumber:andVariable: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[GrowingAutotracker sharedInstance] trackCustomEvent:@"TrackAutoTest" withAttributes:@{@"TrackAutoTest":@"trackAutoTest"}]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; + isGrowingThread = @"1"; + XCTestExpectation *expectation = [self expectationWithDescription:@"track:withNumber:andVariable: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [[GrowingAutotracker sharedInstance] trackCustomEvent:@"TrackAutoTest" withAttributes:@{@"TrackAutoTest":@"trackAutoTest"}]; + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { + // 操作15秒超时,支持不通过 + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + + [self eventTest]; } - (void)test11TrackAndVariableTest { - isMainThread = @"1"; + isGrowingThread = @"1"; XCTestExpectation *expectation = [self expectationWithDescription:@"track:withVariable: fail"]; dispatch_async(dispatch_get_global_queue(0, 0), ^{ [[GrowingAutotracker sharedInstance] trackCustomEvent:@"TrackAutoTest" withAttributes:@{@"TrackAutoTest":@"trackAutoTest"}]; @@ -385,7 +384,7 @@ - (void)test11TrackAndVariableTest { - (void)test12SetVisitorTest { - isMainThread = @"1"; + isGrowingThread = @"1"; XCTestExpectation *expectation = [self expectationWithDescription:@"setVisitor: fail"]; dispatch_async(dispatch_get_global_queue(0, 0), ^{ [[GrowingAutotracker sharedInstance] setVisitorAttributes:@{@"VisitorAutoTest":@"visitorAutoTest"}]; @@ -406,102 +405,33 @@ - (void)test12SetVisitorTest { #pragma mark - GrowingAutoTracker API Test - (void)test13PageVariableToViewControllerTest { + isGrowingThread = @"1"; + UIViewController *vc = [UIViewController new]; + XCTestExpectation *expectation = [self expectationWithDescription:@"setPageVariable:toViewController: fail"]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + vc.growingPageAttributes = @{@"PageVariable": @"pageVariable"}; + [expectation fulfill]; + }); - isMainThread = @"1"; - UIViewController *vc = [UIViewController new]; - XCTestExpectation *expectation = [self expectationWithDescription:@"setPageVariable:toViewController: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - // [[GrowingAutotracker sharedInstance] setPageVariable:@{@"PageVariable": @"pageVariable"} toViewController:vc]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; - -} - -- (void)test14SetPageVariableWithKeyAndStringValueToViewControllerTest { - - isMainThread = @"1"; - UIViewController *vc = [UIViewController new]; - XCTestExpectation *expectation = [self expectationWithDescription:@"setPageVariableWithKey:andStringValue:toViewController: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - // [[ sharedInstance] setPageVariableWithKey:@"PageVariableKey" andStringValue:@"pageVariableKeyString" toViewController:vc]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; - -} - -- (void)test15SetPageVariableWithKeyAndNumberValueToViewControllerTest { - - isMainThread = @"1"; - UIViewController *vc = [UIViewController new]; - XCTestExpectation *expectation = [self expectationWithDescription:@"setPageVariableWithKey:andNumberValue:toViewController: fail"]; - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - // [[GrowingAutotracker sharedInstance] setPageVariableWithKey:@"PageVariableKey" andNumberValue:[NSNumber numberWithInt:55] toViewController:vc]; - [expectation fulfill]; - }); - - [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { - // 操作15秒超时,支持不通过 - if (error) { - NSLog(@"Test failed——%@",expectation.description); - XCTAssertEqual(@"1", @"0"); - } - }]; - - [self eventTest]; + [self waitForExpectationsWithTimeout:15 handler:^(NSError *error) { + // 操作15秒超时,支持不通过 + if (error) { + NSLog(@"Test failed——%@",expectation.description); + XCTAssertEqual(@"1", @"0"); + } + }]; + [self eventTest]; } #pragma mark - private methods - (void)eventTest { - -// // 不允许出现子线程调用API -// XCTAssertEqual(isMainThread, @"1"); -// XCTAssertNotNil(originalEvent); -// XCTAssertTrue(originalEvent.eventType.length > 0); -// [originalEventArray enumerateObjectsUsingBlock:^(GrowingBaseEvent *event, NSUInteger idx, BOOL * _Nonnull stop) { -// -// }]; -// -// [dbEventArray enumerateObjectsUsingBlock:^(GrowingBaseEvent *event, NSUInteger idx, BOOL * _Nonnull stop) { -// [self eventCounterTestEvent:event]; -// }]; - + sleep(1); + // 不允许出现子线程调用API + XCTAssertEqual(isGrowingThread, @"1"); } -- (void)eventCounterTestEvent:(GrowingBaseEvent *)event { - -// NSArray *eventTypes = [[GrowingEventManager shareInstance] getEventTypes]; -// if ([eventTypes containsObject:event.eventTypeKey]) { -// -// XCTAssertNotNil(event.globalSequenceId); -// XCTAssertNotNil(event.eventSequenceId); -// -// } else { -// -// XCTAssertNil(event.globalSequenceId); -// XCTAssertNil(event.eventSequenceId); -// } -} + @end diff --git a/GrowingAnalytics.podspec b/GrowingAnalytics.podspec index 356449613..f2f3c71b8 100644 --- a/GrowingAnalytics.podspec +++ b/GrowingAnalytics.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'GrowingAnalytics' - s.version = '3.0.1-beta' + s.version = '3.0.1' s.summary = 'iOS SDK of GrowingIO.' s.description = <<-DESC GrowingAnalytics具备自动采集基本的用户行为事件,比如访问和行为数据等。目前支持代码埋点、无埋点、可视化圈选、热图等功能。