Software Archive
Read-only legacy content
17061 Discussions

Iphone Emulator

Bill_D_
Beginner
599 Views

I'm developing an app using leaflet.js. When I test it on the emulators for Android, the layer control shows up, but it does not show up on IOS devices. I need to know if this is an emulator problem, or a real problem with the app. Leaflet uses a different image for IOS devices. Does the emulator not provide the device information for IOS so the app can know which image to render? I'm doing this on a Windows machine. Does that limit the way the iPhone emulator identifies itself?

0 Kudos
1 Solution
PaulF_IntelCorp
Employee
599 Views

Regarding your question about the Emulate tab identifying itself to the app: the userAgent string is changed to try and simulate an iOS device, when you choose an iOS device (this is also done to identify the Android and Windows devices). The userAgent string is fixed, you can't manipulate. Just type navigator.userAgent in the debug console when using the Emulate tab and you'll see what I mean. If leaflet.js is using this string to ID the device, it should recognize the iOS devices appropriately. If it is using some other technique, it will probably fail.

Note, also, that the Emulate tab always runs you code inside of a captive Chromium browser. This is not the same as the Safari embedded webview that is on a real device. So if leaflet.js has code that tries to use different features of the runtime based on the platform, that code coud fail. See these articles for some more background:

View solution in original post

0 Kudos
4 Replies
John_H_Intel2
Employee
599 Views

The emulator is really a simulator. There are things that will work differently on device when built as a Cordova app. There are many things that we do not have control over, and this could be one of those issues. 

1. Have you tried running your app in App Preview? Did it work correctly there?
2. Have you tried building your app and running on an actual iOS device?

0 Kudos
Bill_D_
Beginner
599 Views

Thanks for the reply. It works correctly in App Preview on an Android device. I've just been doing Android development and don't have an IOS device. Your answer leads me to believe it might be an emulator issue. I'll continue development and build a more complete version for IOS and have a friend test it.

0 Kudos
PaulF_IntelCorp
Employee
600 Views

Regarding your question about the Emulate tab identifying itself to the app: the userAgent string is changed to try and simulate an iOS device, when you choose an iOS device (this is also done to identify the Android and Windows devices). The userAgent string is fixed, you can't manipulate. Just type navigator.userAgent in the debug console when using the Emulate tab and you'll see what I mean. If leaflet.js is using this string to ID the device, it should recognize the iOS devices appropriately. If it is using some other technique, it will probably fail.

Note, also, that the Emulate tab always runs you code inside of a captive Chromium browser. This is not the same as the Safari embedded webview that is on a real device. So if leaflet.js has code that tries to use different features of the runtime based on the platform, that code coud fail. See these articles for some more background:

0 Kudos
Bill_D_
Beginner
599 Views

Thanks, this is great information. I'm finding that leaflet.js expects some default UI styles that the AppFramework UI is changing, so it might also be a CSS issue. It's been difficult to track these down, but the debugger has been a great tool to do it.
 

0 Kudos
Reply