ios – SCORM lesson standing is “In Progress” even after full the studying of lesson

ios – SCORM lesson standing is “In Progress” even after full the studying of lesson


We now have SCORM lesson characteristic in our iOS cell app. We open the SCORM lesson in WKWebView with the next code:

WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
    if([[NSUserDefaults standardUserDefaults] objectForKey:[TMEUserDefaultKeys cdnSetCookie]]) {
        WKUserContentController *userContentController = [[WKUserContentController alloc] init];
        [userContentController addScriptMessageHandler:self name:@"callNativeAction"];
        [userContentController addScriptMessageHandler:self name:@"callNativeActionWithArgs"];
        WKUserScript *cookieScript = [[WKUserScript alloc]
              initWithSource:[NSString
                                 stringWithFormat:@"document.cookie="%@";",
                                                  [[NSUserDefaults standardUserDefaults] objectForKey:[TMEUserDefaultKeys cdnSetCookie]]]
               injectionTime:WKUserScriptInjectionTimeAtDocumentStart
            forMainFrameOnly:YES];
        [userContentController addUserScript:cookieScript];
        [configuration setUserContentController:userContentController];
    }
    
    WKPreferences *preferences = [[WKPreferences alloc] init];
    preferences.javaScriptEnabled = YES;
    preferences.javaScriptCanOpenWindowsAutomatically = YES;
    configuration.preferences = preferences;
    configuration.websiteDataStore = [WKWebsiteDataStore defaultDataStore];
    configuration.allowsInlineMediaPlayback = YES;
    configuration.allowsAirPlayForMediaPlayback = YES;
    configuration.allowsPictureInPictureMediaPlayback = YES;
    configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone; //WKAudiovisualMediaTypeNone;
    NSArray<NSHTTPCookie *> *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
    for(NSHTTPCookie *cookie in cookies) {
        [configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:nil];
    }

    self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:configuration];
    self.webView.UIDelegate = self;
    self.webView.navigationDelegate = self;
    self.webView.allowsLinkPreview = YES;
    self.webView.translatesAutoresizingMaskIntoConstraints = false;
    self.webView.scrollView.bounces = NO;
    self.webView.scrollView.showsVerticalScrollIndicator = NO;
    self.webView.allowsBackForwardNavigationGestures = YES;
    self.webView.contentMode = UIViewContentModeScaleAspectFit;
    
    UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self motion:@selector(setNavigationBarWithGestureRecognizer:)];
    UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self motion:@selector(setNavigationBarWithGestureRecognizer:)];
    swipeUp.delegate = self;
    swipeDown.delegate = self;
    // Setting the swipe route.
    [swipeUp setDirection:UISwipeGestureRecognizerDirectionUp];
    [swipeDown setDirection:UISwipeGestureRecognizerDirectionDown];
    [self.webView addGestureRecognizer:swipeUp];
    [self.webView addGestureRecognizer:swipeDown];
     
    [self.view addSubview:self.webView];

Even after we full the studying of lesson, whereas we fetch the standing of the lesson, it returns In Progress.

Thanks prematurely.

author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 
rooshohttps://www.roosho.com
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here


Latest Articles

author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog.