Cordova Slack Digest

Tue, 25 Jan 2022 08:21:12 GMT

User count: 4685

Join the conversation at slack.cordova.io

Channel #general (100 messages)


Mon, 24 Jan 2022 09:13:52 GMT

@jac.darby says

my app is getting stuck on the splash screen as well as saying cordova is not defined when it's coming out of suspension

Mon, 24 Jan 2022 09:14:11 GMT

@jac.darby says

i‘ve removed all plugins and in my index.js i’m just calling console.log on the device ready event

Mon, 24 Jan 2022 09:14:34 GMT

@jac.darby says

if i run cordova plugin ls it says i don‘t have any plugs installed, so i’m not sure whats causing it

Mon, 24 Jan 2022 09:31:41 GMT

@jac.darby says

Sorry cordova 11, IOS 6.2.0, ios only

Mon, 24 Jan 2022 11:40:11 GMT

@jcesarmobile says

Do you have cordova.js linked in you index.html?

Mon, 24 Jan 2022 12:33:11 GMT

@jac.darby says

Yeah, in the head

Mon, 24 Jan 2022 12:33:22 GMT

@jac.darby says

I can see a cordova.js file as well, it's getting generated

Mon, 24 Jan 2022 12:33:58 GMT

@jac.darby says

When I said iOS only, I meant only iOS is experiencing the problem, Android seems fine

Mon, 24 Jan 2022 13:17:29 GMT

@norman137 says

I‘d try refreshing the webview, which you can do by connecting the Safari web inspector to the app and pressing cmd+r while the inspector is focused. If the error only occurs after resuming, hopefully it will also trigger on refreshing, or perhaps it’s a race condition. Either way, if you can get the error to trigger while the inspector is connected it may provide a bit more insight, including a stacktrace of what is making the call to the cordova api.

Mon, 24 Jan 2022 13:18:12 GMT

@jac.darby says

Ah - I didn't even try that I just assumed the lockscreen would stop that for some reason

Mon, 24 Jan 2022 13:18:44 GMT

@jac.darby says

splash screen, not lock*

Mon, 24 Jan 2022 13:21:41 GMT

@jac.darby says

Nothing, but thanks

Mon, 24 Jan 2022 13:21:53 GMT

@jac.darby says

I also should have provided more of the error from suspending/resuming

Mon, 24 Jan 2022 13:21:56 GMT

@jac.darby says

[Log] exception nativeEvalAndFetch : ReferenceError: Can't find variable: cordova (x2)

Mon, 24 Jan 2022 13:22:55 GMT

@norman137 says

Try the “pause on exception” feature

Mon, 24 Jan 2022 13:23:16 GMT

@norman137 says

you may have to cycle though multiple breakpoints before you hit that particular reference error

Mon, 24 Jan 2022 13:23:33 GMT

@jac.darby says

try { cordova.require('cordova/exec').nativeEvalAndFetch(function() { cordova.fireDocumentEvent('active'); }) } catch (e) { console.log('exception nativeEvalAndFetch : ' + e); } ;

Mon, 24 Jan 2022 13:23:53 GMT

@norman137 says

hmm

Mon, 24 Jan 2022 13:24:09 GMT

@jac.darby says

is that from evalJs?

Mon, 24 Jan 2022 13:25:33 GMT

@norman137 says

well if you breakpoint, you should get a stacktrace, which should explain how, or at least why it's entering to that state

Mon, 24 Jan 2022 13:26:28 GMT

@jac.darby says

here‘s my inspector, I’m going to have to read up on how to use the safari one tbh, but thanks for everything so far

Mon, 24 Jan 2022 13:26:35 GMT

@norman137 says

> is that from evalJs? Not 100% sure, really I‘m not super knowledgable on the iOS side of things. ENough to get by, that’s about it.

Mon, 24 Jan 2022 13:28:02 GMT

@norman137 says

Yah, safari web inspector is a bit different -- personally I don‘t like it compared to the old webkit one / chrome’s inspector.

Mon, 24 Jan 2022 13:28:16 GMT

@norman137 says

Doens't look like your paused though

Mon, 24 Jan 2022 13:28:54 GMT

@norman137 says

but if it‘s an anonymous script might be difficult to do what I’m trying to do...

Mon, 24 Jan 2022 13:29:32 GMT

@jac.darby says

Yeah I think it's just snippets of javascript being ran by objective c

Mon, 24 Jan 2022 13:29:57 GMT

@norman137 says

Yah probably

Mon, 24 Jan 2022 13:30:28 GMT

@norman137 says

Very strange though, for it to be running seemingly before cordova.js is loaded in

Mon, 24 Jan 2022 13:30:29 GMT

@jac.darby says

those anon scripts are identical, but the event is different, I get resign and active

Mon, 24 Jan 2022 13:31:15 GMT

@jac.darby says

yeah I removed all the plugins, and changed the index.js to just be a console.log on the deviceready, so I'm lost on it too

Mon, 24 Jan 2022 13:32:00 GMT

@jac.darby says

But yeah it must be something i've done...

Mon, 24 Jan 2022 13:32:02 GMT

@norman137 says

your html does have <script src="cordova.js"></script> correct?

Mon, 24 Jan 2022 13:32:11 GMT

@norman137 says

and it doens't defer/async that script tag

Mon, 24 Jan 2022 13:32:21 GMT

@jac.darby says

it was in the body, i moved it in to the header

Mon, 24 Jan 2022 13:32:27 GMT

@jac.darby says

I'll past it the html in

Mon, 24 Jan 2022 13:32:50 GMT

@norman137 says

I guess I'd check the network tba in the inspector to confirm that the script itself is shown being loaded in

Mon, 24 Jan 2022 13:33:09 GMT

@jac.darby says

network is a good call, didn't think of that

Mon, 24 Jan 2022 13:35:43 GMT

@jac.darby says

Mon, 24 Jan 2022 13:36:04 GMT

@jac.darby says

there's nothing in the network tab

Mon, 24 Jan 2022 13:37:51 GMT

@norman137 says

nothing at all, or no stated errors for cordova.js? You should at least see an entry for cordova.js

Mon, 24 Jan 2022 13:39:51 GMT

@jac.darby says

doesn't change if i do document.location.reload or reload

Mon, 24 Jan 2022 13:40:00 GMT

@jac.darby says

I think maybe we've gotten closer

Mon, 24 Jan 2022 13:40:13 GMT

@jac.darby says

would now explain why it's not defined

Mon, 24 Jan 2022 13:40:14 GMT

@norman137 says

ah well

Mon, 24 Jan 2022 13:40:24 GMT

@norman137 says

it's not loading your html file

Mon, 24 Jan 2022 13:40:29 GMT

@norman137 says

it's loading about:blank

Mon, 24 Jan 2022 13:40:39 GMT

@norman137 says

so that explains quite a bit

Mon, 24 Jan 2022 13:40:50 GMT

@jac.darby says

I didn't know what was normal for cordova haha, thanks

Mon, 24 Jan 2022 13:41:02 GMT

@jac.darby says

is it something missing out my XML?

Mon, 24 Jan 2022 13:41:20 GMT

@norman137 says

what's your <content> tag inside your config.xml?

Mon, 24 Jan 2022 13:42:48 GMT

@norman137 says

Someone else had an issue where the webview didn‘t load properly unless <content> tag was left in it’s default state which is <content src="index.html" />, and your html file was placed at www/index.html

Mon, 24 Jan 2022 13:42:49 GMT

@jac.darby says

<content src="index.html" />

Mon, 24 Jan 2022 13:43:01 GMT

@jac.darby says

oh my

Mon, 24 Jan 2022 13:43:02 GMT

@norman137 says

k

Mon, 24 Jan 2022 13:43:04 GMT

@jac.darby says

i'll try it

Mon, 24 Jan 2022 13:43:07 GMT

@jac.darby says

i'm excited

Mon, 24 Jan 2022 13:43:25 GMT

@jac.darby says

oh there's no change, I thought you meant i had to put www in it

Mon, 24 Jan 2022 13:43:27 GMT

@norman137 says

yah your html file should be placed in the www/ folder

Mon, 24 Jan 2022 13:43:45 GMT

@norman137 says

your <content> tag should remain unchanged

Mon, 24 Jan 2022 13:44:21 GMT

@norman137 says

so... html should be placed at <cordovaProjectFolder>/www/index.html

Mon, 24 Jan 2022 13:44:34 GMT

@jac.darby says

thats the layout in my ios platform folder

Mon, 24 Jan 2022 13:44:59 GMT

@norman137 says

now I'm kinda scratching my head lol

Mon, 24 Jan 2022 13:45:12 GMT

@jac.darby says

I have been for a week

Mon, 24 Jan 2022 13:47:06 GMT

@norman137 says

You might need to load the project in xcode so that you can see the native console output.

In the platforms/ios folder there's an xcworkspace file that can be opened in xcode

Mon, 24 Jan 2022 13:48:31 GMT

@norman137 says

Probably hints there on why it's loading about:blank instead of the index.html

Usually it‘s because it’s refusing to load the document for whatever reason.

Mon, 24 Jan 2022 13:53:27 GMT

@jac.darby says

... it built from xcode?

Mon, 24 Jan 2022 13:53:47 GMT

@jac.darby says

i am now more confused

Mon, 24 Jan 2022 13:54:18 GMT

@jac.darby says

probably not the fairest test, i also built it to an actual device

Mon, 24 Jan 2022 14:00:28 GMT

@norman137 says

I mean to open up the xcode project file and run from xcode

Mon, 24 Jan 2022 14:01:40 GMT

@jac.darby says

as in the play button within x code?

Mon, 24 Jan 2022 14:02:11 GMT

@norman137 says

yup

Mon, 24 Jan 2022 14:02:16 GMT

@norman137 says

maybe you were already doing that

Mon, 24 Jan 2022 14:03:06 GMT

@jac.darby says

yeah, it launches a working app

Mon, 24 Jan 2022 14:03:11 GMT

@jac.darby says

to two of my devices

Mon, 24 Jan 2022 14:03:45 GMT

@jac.darby says

but i've made apps with the CI as well, and they launch to blank

Mon, 24 Jan 2022 14:04:31 GMT

@norman137 says

Yah, so more importantly it connects the xcode debugger, and you should see the native console output

Mon, 24 Jan 2022 14:04:48 GMT

@norman137 says

Does refreshing the page also trigger the bug, or just when the app pauses/resumes?

Mon, 24 Jan 2022 14:09:42 GMT

@jac.darby says

The app works entirely though there's no error

Mon, 24 Jan 2022 14:09:50 GMT

@jac.darby says

there's nothing in the native logs

Mon, 24 Jan 2022 14:10:04 GMT

@jac.darby says

and the safari stuff looks normal with actual traffic coming in

Mon, 24 Jan 2022 14:10:57 GMT

@norman137 says

Then if you pause the app (e.g. press teh home button so the app goes into the background), then resume the app (bring it back into foreground) ?

Mon, 24 Jan 2022 14:11:09 GMT

@jac.darby says

yeah even that

Mon, 24 Jan 2022 14:12:04 GMT

@norman137 says

I do have the correct understanding right, it was an issue when resuming?

Mon, 24 Jan 2022 14:13:16 GMT

@jac.darby says

Ah I probably wasn't clear, the app is stuck on a splash screen

Mon, 24 Jan 2022 14:13:37 GMT

@jac.darby says

the only error it shows is the cordova is not defined when resuming/suspending

Mon, 24 Jan 2022 14:13:45 GMT

@jac.darby says

cordova isn't defined in the safari console

Mon, 24 Jan 2022 14:14:28 GMT

@norman137 says

k, but how does the splashscreen hide normally? Do you use the AutoHideSplashScreen config preference or do you manually control the splashscreen from JS code?

Mon, 24 Jan 2022 14:15:46 GMT

@jac.darby says

looking at it, I assume it‘s running AutoHideSplashScreen but it’s not in the config

Mon, 24 Jan 2022 14:15:53 GMT

@jac.darby says

is it auto by default?

Mon, 24 Jan 2022 14:15:57 GMT

@norman137 says

i think the default value is true

Mon, 24 Jan 2022 14:15:59 GMT

@jac.darby says

it's actually a 3 year old project

Mon, 24 Jan 2022 14:16:01 GMT

@norman137 says

I'd have to double check

Mon, 24 Jan 2022 14:16:22 GMT

@jac.darby says

yeah defaults to true

Mon, 24 Jan 2022 14:21:47 GMT

@jac.darby says

wait the platform_www folder doesn't have an index html

Mon, 24 Jan 2022 14:21:48 GMT

@norman137 says

Doing a few things at a same time, but just double checked, and it looks like auto hide is handled completely on the native side

Mon, 24 Jan 2022 14:21:59 GMT

@jac.darby says

thanks you've helped loads tbh

Mon, 24 Jan 2022 14:22:12 GMT

@jac.darby says

do i need to worry about the platform_www?

Mon, 24 Jan 2022 14:23:37 GMT

@jac.darby says

oh reading up on it, no it doesn't sound like it.

Mon, 24 Jan 2022 14:30:58 GMT

@norman137 says

> do i need to worry about the platform_www? Not really sure on this... I think platform_www is mostly used for the platform's www sources as well as maybe plugin www sources as a way to separate framework code from app code.

Mon, 24 Jan 2022 14:31:49 GMT

@norman137 says

Don't really have my own mac to test things out 😧

Channel #cordova-ios (1 messages)


Mon, 24 Jan 2022 22:35:41 GMT

@michaelbschmidt says

camera plugin on iOS 15: does anyone have something working to make getPicture on ios15 work with geolocation on?