Hype in a WKWebview inside Xcode 9 and iOS11


(Nick ) #1

I received some feedback from folks over the past few days about Xcode 9 and iOS11 not working well with my tutorial on Hype and Xcode.

So I went ahead and put out a new video that will help users attach a Hype HTML5 file into a WKWebview rather than the old UIWebview in Xcode 9.

NOTE: Xcode 9 is a bit buggy but this video will help you update your projects and start some new ones.

Playlist with a little intro for those who need a Hype refresher is located…


#2

Great! Thank you very much Nick.


(iain) #3

Great to see this, but just wondering what the problems with the old UIWebView are? I’ve just launched an app that seems OK with the old strategy.


(Mark Hunte) #4

The problem is Apple are not supporting it in the Webkit Framework anymore.

Important
Starting in iOS 8.0 and OS X 10.10, use WKWebView to add web content to your app. Do not use UIWebView or WebView.

(https://developer.apple.com/documentation/webkit/wkwebview)

So it is best to adopt it now rather than later where you may run into issues with it.


(Nick ) #5

Yes What Mark said! :slight_smile:


(James Howell) #6

Issue I have with embed is that it loads, but I am getting a privacy warning once javascript runs with session starting.
Also page with textfields just about to load.
Cant see what I can do since do not see how privacy been affected by textfields.
Probably not the right place for this (more Xcode issue) but does anyone have any ideas

html is here: http://ceva-apps.s3.amazonaws.com/DryYourBest/DryYourBest.html

It happens as soon as you press Start button.
Thinking maybe email field?


(Nick ) #7

what is the exact error that you are getting?


(James Howell) #8

This is everything I am getting from the log:
2017-09-30 06:33:28.399384+0100 DryYourBest[23928:5522533] Flurry: Starting session on Agent Version [Flurry_iOS_188_7.8.1]
2017-09-30 06:33:28.634933+0100 DryYourBest[23928:5522533] lang is en
2017-09-30 06:33:28.837625+0100 DryYourBest[23928:5522595] -[FlurryWatchConnectivity init]: WatchConnectivity isn’t linked, Flurry Analytics will be disabled for any paired watch
2017-09-30 06:33:29.754528+0100 DryYourBest[23928:5522533] didFinishNavigation
2017-09-30 06:33:42.381976+0100 DryYourBest[23928:5522533] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-09-30 06:33:42.387578+0100 DryYourBest[23928:5522533] [MC] Reading from public effective user settings.


(Nick ) #9

This error is being thrown by your Flurry SDK analytics.
This is not an HTML5 embedded error or iOS per se.

Did you use CocoaPods?

This is a tutorial for setting up Flurry in iOS you may want to run through that and make sure everything is setup properly.


(Mark Hunte) #10

I assume you are using the simulator ,
When I get this type of logging I have always assumed it is more reports within the Simulator rather than errors.

WatchConnectivity isn’t linked, I have not used watch APIs but would have thought this is normal in the simulator.

I would suggest googling some of the logging as other people will be getting it and you will find a general idea of whats what when it comes to the simulator.


(James Howell) #11

Thanks for your reply.
Have been using Flurry for 7 years. Was using it without cocoapods due to historic use. So reinstalled with cocoapods.
I am running it on an iPad (not simulator).
Rerun the app and still getting the same response.
Exchanged the html5 file (for simpler one without pouchdb) and it works.
So definitively conflict with original html5.
Any thoughts?


(Nick ) #12

Does your new HTML5 have text entry fields?
If not I would start there and deconstruct each field to see if anything is messed up.
Pain in the you know what but it is the best way to isolate the errors.
With any luck you may hit it on the first field.


#13

Don’t know if I’m the only one, but the scroll/bouncing of the webView once it’s on the iPad/Phone I found very annoying. So I found a way to get rid of that. Just add: webView.scrollView.bounces = false (swift 3) below the last line in ViewController.swift.

I hope Apple won’t mind.


(James Howell) #14

Yes it has text entry fields.
But these do not seem to have any issues but this code seems to be the culprit:

// chk if the db has first row - session
dyb_db.get(“session”, function (err, doc) {
if (err) {
hypeDocument.showSceneNamed(‘farm_details’, hypeDocument.kSceneTransitionCrossfade, 0.4);
if (err.status == 404) {
dyb_db.put({
_id: “session”,
sessions: []
});
}
} else {
dyb_db.get(“session”, function (err, doc) {
if (doc.sessions.length == 0) {
hypeDocument.showSceneNamed(‘farm_details’, hypeDocument.kSceneTransitionCrossfade, 0.4);
} else {
var activeSession = doc.sessions.length - 1;
if (doc.sessions[activeSession].sectionCompleted == “no”) {
hypeDocument.showSceneNamed(‘q_a’, hypeDocument.kSceneTransitionCrossfade, 0.4);
} else {
hypeDocument.showSceneNamed(‘farm_details’, hypeDocument.kSceneTransitionCrossfade, 0.4);

            }
        }
    });

}
});

Anyone has any ideas what the conflict is in iOS


(Nick ) #15

@HowellJames
Sorry I was busy in some work last week,
I will look at this over the weekend and see what I can come up with.

Nick


(James Howell) #16

Getting closer. Changed code in pouchdb.
Now runs on simulator but not on device?