У нас есть функция урока Scorm в нашем мобильном приложении iOS. Мы открываем урок Scorm в WkwebView со следующим кодом: < /p>
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 *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 action:@selector(setNavigationBarWithGestureRecognizer:)];
UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(setNavigationBarWithGestureRecognizer:)];
swipeUp.delegate = self;
swipeDown.delegate = self;
// Setting the swipe direction.
[swipeUp setDirection:UISwipeGestureRecognizerDirectionUp];
[swipeDown setDirection:UISwipeGestureRecognizerDirectionDown];
[self.webView addGestureRecognizer:swipeUp];
[self.webView addGestureRecognizer:swipeDown];
[self.view addSubview:self.webView];
< /code>
Даже после того, как мы завершим чтение урока, в то время как мы получаем статус урока, он возвращается в процесс. < /p>
Заранее.
Подробнее здесь: https://stackoverflow.com/questions/793 ... -of-lesson
Статус урока Scorm «в процессе» даже после завершения чтения урока ⇐ IOS
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение