L'application Enterprise se bloque après l'installation à partir de MDM

Nous avons une application iOS 9.2 qui fonctionne bien dans les tests lorsqu'elle est installée via Xcode et le Mac local. Lorsque nous installons cette application via notre server MDM, elle se bloque lors du premier access aux données. Il se termine avec l'erreur "Impossible de mettre à jour la scène après 10h00".

Je de vérifier la sortie de la console, il semble être en train de raccrocher après le process de succès dans la méthode requireLogin (après le [self checkIntSession: self.sessionDetail].

Nous utilisons le MDM de Novell et non la version Apple. J'ai créé d'autres applications qui ont installé et exécuté sans problèmes.

J'ai essayé une construction et une installation propres. Cela n'a pas aidé. Je ne peux pas find une question similaire répondue ici ou ailleurs. Je ne sais pas où aller avec ce prochain. Toute aide serait appréciée.

#import "Security.h" #import "XMLTypeItem.h" #import "ParseTypeXML.h" #import "XMLPostSecurity.h" #import "XMLSessionItem.h" #import "FileSaving.h" #import <LocalAuthentication/LocalAuthentication.h> @implementation Security - (NSSsortingng *)resortingeveESN { NSFileManager *fileManager = [NSFileManager defaultManager]; NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSSsortingng *documentsDirectoryPath = [directoryPaths objectAtIndex:0]; NSSsortingng *fullPath = [documentsDirectoryPath ssortingngByAppendingSsortingng:@"/session.txt"]; if ([fileManager fileExistsAtPath:fullPath]==YES) { _finished = false; [self readSession]; NSSsortingng *result = [self checkSession:_sessionDetail]; if ([result isEqualToSsortingng:@"Error"]) { NSSsortingng *userESN = [self newFile]; if (self.getUserESN){ self.getUserESN(userESN); } return userESN; } else { return result; } } else { _finished = false; NSSsortingng *userESN = [self newFile]; return userESN; } } - (NSSsortingng *)newFile { [self requireLogin]; if (self.findUserESN) { self.findUserESN(_passESN); } return _passESN; } - (void)requestSession { NSSsortingng *idfv = [[[UIDevice currentDevice] identifierForVendor] UUIDSsortingng]; NSSsortingng *url = @"https://company.com/loginfile"; NSMutableSsortingng *postText = [[NSMutableSsortingng alloc] init]; [postText appendSsortingng:idfv]; NSSsortingng *postBody = [NSSsortingng ssortingngWithSsortingng:postText]; XMLPostSecurity *postAction = [[XMLPostSecurity alloc] init]; _sessionDetail = [postAction sendPostRequestToUrl:url withBody:postBody]; FileSaving *saver = [[FileSaving alloc] init]; [saver saveSession:self.sessionDetail]; } -(NSSsortingng *)readSession { NSFileManager *fileManager = [NSFileManager defaultManager]; NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSSsortingng *documentsDirectoryPath = [directoryPaths objectAtIndex:0]; NSSsortingng *fullPath = [documentsDirectoryPath ssortingngByAppendingSsortingng:@"/session.txt"]; if (self.fileExistsNow) { self.fileExistsNow([fileManager fileExistsAtPath:fullPath]); } NSFileManager *fileManagerTwo; NSData *dataBuffer; fileManagerTwo = [NSFileManager defaultManager]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSSsortingng *documentsDirectory = [paths objectAtIndex:0]; NSSsortingng *filePath = [documentsDirectory ssortingngByAppendingSsortingng:@"/session.txt"]; dataBuffer = [fileManagerTwo contentsAtPath:filePath]; _sessionDetail = [[NSSsortingng alloc] initWithData:dataBuffer encoding:(NSASCIISsortingngEncoding)]; return _sessionDetail; } -(void)readIntSession { NSFileManager *fileManager = [NSFileManager defaultManager]; NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSSsortingng *documentsDirectoryPath = [directoryPaths objectAtIndex:0]; NSSsortingng *fullPath = [documentsDirectoryPath ssortingngByAppendingSsortingng:@"/session.txt"]; if (self.fileExistsNow) { self.fileExistsNow([fileManager fileExistsAtPath:fullPath]); } NSFileManager *fileManagerTwo; NSData *dataBuffer; fileManagerTwo = [NSFileManager defaultManager]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSSsortingng *documentsDirectory = [paths objectAtIndex:0]; NSSsortingng *filePath = [documentsDirectory ssortingngByAppendingSsortingng:@"/session.txt"]; dataBuffer = [fileManagerTwo contentsAtPath:filePath]; _sessionDetail = [[NSSsortingng alloc] initWithData:dataBuffer encoding:(NSASCIISsortingngEncoding)]; } -(NSSsortingng *)checkSession:(NSSsortingng *)sessionFound { NSDictionary *cookieProperties = [NSDictionary dictionaryWithObjectsAndKeys: @"ollie/", NSHTTPCookieDomain, @"\\", NSHTTPCookiePath, @"Cookie", NSHTTPCookieName, sessionFound, NSHTTPCookieValue, nil]; NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieProperties]; NSArray *cookieArray = [NSArray arrayWithObject:cookie]; NSDictionary *headers = [NSHTTPCookie requestHeaderFieldsWithCookies:cookieArray]; NSMutableSsortingng *url = [[NSMutableSsortingng alloc] initWithSsortingng:@"https://company.com/file.php"]; NSURL *urlNew = [NSURL URLWithSsortingng:url]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlNew]; [request setHTTPMethod:@"GET"]; [request setAllHTTPHeaderFields:headers]; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { return; } if ([response isKindOfClass:[NSHTTPURLResponse class]]) { NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode]; if (statusCode != 200) { if (statusCode == 401) { // Insert process for thumbprint and session cookie pull NSFileManager *fileManagerThree = [NSFileManager defaultManager]; NSSsortingng *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSSsortingng *sessionPath = [documentsPath ssortingngByAppendingPathComponent:@"session.txt"]; NSError *error; BOOL success = [fileManagerThree removeItemAtPath:sessionPath error:&error]; if (success) { } else { } } else { return; } } } self.parseData = data; }]; [task resume]; if (self.parseDataAvailable) { self.parseDataAvailable(self.parseData); } ParseTypeXML *myParser = [[ParseTypeXML alloc] initWithData:self.parseData]; if ([myParser.esn count] == 0) { return @"Error"; } else { return myParser.esn[0]; } } -(void)checkIntSession:(NSSsortingng *)sessionFound { NSDictionary *cookieProperties = [NSDictionary dictionaryWithObjectsAndKeys: @"ollie/", NSHTTPCookieDomain, @"\\", NSHTTPCookiePath, @"Cookie", NSHTTPCookieName, sessionFound, NSHTTPCookieValue, nil]; NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieProperties]; NSArray *cookieArray = [NSArray arrayWithObject:cookie]; NSDictionary *headers = [NSHTTPCookie requestHeaderFieldsWithCookies:cookieArray]; NSMutableSsortingng *url = [[NSMutableSsortingng alloc] initWithSsortingng:@"https://company.com/file.php"]; NSURL *urlNew = [NSURL URLWithSsortingng:url]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlNew]; [request setHTTPMethod:@"GET"]; [request setAllHTTPHeaderFields:headers]; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { return; } if ([response isKindOfClass:[NSHTTPURLResponse class]]) { NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode]; if (statusCode != 200) { if (statusCode == 401) { // Insert process for thumbprint and session cookie pull NSFileManager *fileManagerThree = [NSFileManager defaultManager]; NSSsortingng *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSSsortingng *sessionPath = [documentsPath ssortingngByAppendingPathComponent:@"session.txt"]; NSError *error; BOOL success = [fileManagerThree removeItemAtPath:sessionPath error:&error]; if (success) { } else { } } else { return; } } } self.parseData = data; }]; [task resume]; if ( self.parseDataAvailable) { self.parseDataAvailable(self.parseData); } ParseTypeXML *myParser = [[ParseTypeXML alloc] initWithData:self.parseData]; if ([myParser.esn count] == 0) { _passESN = @"Error"; } else { _passESN = myParser.esn[0]; } } - (void)requireLogin { LAContext *context = [[LAContext alloc] init]; NSError *error = nil; if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiomesortingcs error:&error]) { // Authenticate User [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiomesortingcs localizedReason:@"You must log in to the app." reply:^(BOOL success, NSError * _Nullable error) { if (success) { self.finished = true; if (self.touchIDWorks){ self.touchIDWorks(self.finished); } [self requestSession]; [self readIntSession]; [self checkIntSession:self.sessionDetail]; } else { switch (error.code) { case LAErrorAuthenticationFailed: break; case LAErrorUserCancel: break; case LAErrorUserFallback: break; default: break; } } }]; } else { } } - (void)dataIsThere:(void (^)(NSData *foundData))finishBlock { self.parseDataAvailable = finishBlock; } - (void)thumbOK:(void (^)(BOOL success))finishBlock { self.touchIDWorks = finishBlock; } - (void)esnIsHere:(void (^)(NSSsortingng *newESN))finishBlock { self.getUserESN = finishBlock; } - (void)esnIsReady:(void (^)(NSSsortingng *))finishBlock { self.findUserESN = finishBlock; } - (void)fileReady:(void (^)(BOOL))finishBlock { self.fileExistsNow = finishBlock; } 

Il est appelé depuis ViewController.m:

 - (IBAction)getESN:(id)sender { Security *pulledESN = [[Security alloc] init]; self.gottenESN = [pulledESN resortingeveESN]; self.responseLabel.text = self.gottenESN; } 

=== Ajouter plus tard ===

Mettre dans les blocs d'achèvement n'a pas résolu le problème. Le code semble toujours se bloquer après avoir terminé la section requireLogin success. Comme j'ai besoin d'un return ou de quelque chose.

Cette ligne me semble super effrayante:

  while ( self.parseData == NULL ); 

Il peut s'agir d'un problème de version de debugging ou de version. Je pourrais imaginer une version de version optimisant la lecture de self.parseData pour ne pas continuer à vérifier si d'autres threads l'ont mis à jour.

Je recommand que vous le fassiez d'une autre manière – en interrogeant une boucle comme celle-ci, le processeur est bloqué à 100% pendant l'attente. Je suggère de l'écrire pour être asynchronous avec les blocs d'achèvement que vous appelez lorsque datatables sont prêtes.