#ios #objective-c #crash #afnetworking #httpsession
Вопрос:
Использование pod версии pod «AFNetworking», «2.2.1»
В приведенном ниже методе приложение иногда выходит из строя при [возобновлении задачи]; и поскольку я не могу воспроизвести проблему, я не могу добраться до корня этой причины.
- (NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:nil];
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
if (error) {
if (failure) {
failure(task, error);
}
} else {
if (success) {
success(task, responseObject);
}
}
}];
[task resume];
return task;
}
Ниже приведен журнал сбоев
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1bc1ff020 objc_release 16
1 Foundation 0x1a84eff70 NSKeyValuePopPendingNotificationLocal 152
2 Foundation 0x1a84efe90 NSKeyValueDidChange 360
3 Foundation 0x1a84ef8dc -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] 648
4 Foundation 0x1a84283a0 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey🔑key:usingBlock:] 72
5 Foundation 0x1a84ea830 _NSSetLongLongValueAndNotify 312
6 CFNetwork 0x1a7a27b08 __CFTubeSetTubeTypeNotifier 57724
7 AFNetworking 0x10331ed7c -[AFHTTPSessionManager POST:parameters:success:failure:] 179 (AFHTTPSessionManager.m:179)
8 Lief 0x102e431c0 -[AppOpenCounter _notifyServerOfAppOpen] 125 (AppOpenCounter.m:125)
9 Lief 0x102e429c0 -[AppOpenCounter onAppOpened] 46 (AppOpenCounter.m:46)
10 Lief 0x102db7968 -[AppDelegate application:didFinishLaunchingWithOptions:] 164 (AppDelegate.m:164)
11 UIKitCore 0x1a9b77228 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] 360
12 UIKitCore 0x1a9b79290 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] 5136
13 UIKitCore 0x1a9b7ecec -[UIApplication _runWithMainScene:transitionContext:completion:] 1244
14 UIKitCore 0x1a91d4c74 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] 152
15 UIKitCore 0x1a9742f9c _UIScenePerformActionsWithLifecycleActionMask 112
16 UIKitCore 0x1a91d580c __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke 224
17 UIKitCore 0x1a91d52cc -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] 484
18 UIKitCore 0x1a91d561c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] 768
19 UIKitCore 0x1a91d4e58 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] 340
20 UIKitCore 0x1a91dd3a4 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke 196
21 UIKitCore 0x1a964f60c [BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] 892
22 UIKitCore 0x1a975b6c4 _UISceneSettingsDiffActionPerformChangesWithTransitionContext 272
23 UIKitCore 0x1a91dd09c -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] 384
24 UIKitCore 0x1a90045a0 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke 776
25 UIKitCore 0x1a9002f14 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] 256
26 UIKitCore 0x1a90041c8 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] 248
27 UIKitCore 0x1a9b7ce8c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] 572
28 UIKitCore 0x1a9678e38 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] 388
29 FrontBoardServices 0x1b6f303bc -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] 432
30 FrontBoardServices 0x1b6f5bd04 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.200 128
Ссылка на проблему с AFNetworking :-
https://github.com/AFNetworking/AFNetworking/issues/4663
любая помощь была бы великолепна….!!!
спасибо и с уважением