У нас есть функция урока 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
Программируем под IOS
-
Anonymous
1738061323
Anonymous
У нас есть функция урока 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>
Заранее.
Подробнее здесь: [url]https://stackoverflow.com/questions/79393501/scorm-lesson-status-is-in-progress-even-after-complete-the-reading-of-lesson[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия