safariView not working (and documentation missing!)

Hi all,

I’m doing something simple wrong because it’s not working. I’ve basically copy/pasted the safariView sample code, but it’s not working: native.canShowPopup( “safariView” ) returns false.

Can anyone shed some light here? To make things a bit more complicated, this link in the documentation is dead:

https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_safariView/index.html

Could this link please be fixed?

For those that want to help out, I have activated the plugin, and my code is basically this in main.lua:

local function safariListener( event ) if ( event.action == "failed" ) then print( "Error loading the URL" ) elseif ( event.action == "loaded" ) then print( "Page loaded!" ) elseif ( event.action == "done" ) then print( "Safari view closed" ) end end local popupOptions = { url = "https://coronalabs.com", animated = true, entersReaderIfAvailable = true, listener = safariListener } -- Check if the Safari View is available local safariViewAvailable = native.canShowPopup( "safariView" ) print("---") print("safariViewAvailable returns:") print(safariViewAvailable) print("---") if safariViewAvailable then -- Show the Safari View native.showPopup( "safariView", popupOptions ) else print("safariView not available") end

and this in build.settings - relevant stuff at the bottom:

settings = { orientation = {default = "landscape",supported = {"landscape"},}, iphone = { plist = { UIAppFonts = {}, UIPrerenderedIcon = false, UIStatusBarHidden = true, CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", --57x57 (iPhone and iPod touch application icon) "Icon@2x.png", --114x114 (RETINA iPhone and iPod touch application icon) "Icon-iPad.png", --72x72 (iPad 1 application icon) "Icon-72.png", --72X72 (RETINA iPad 2 OLD name) "Icon-iPad@2x.png", --144x144 (RETINA iPad 3) "Icon-Small.png", --29x29 (iPhone and iPod touch Spotlight search results and Settings icon) "Icon-Small@2x.png", --58x58 (RETINA iPhone and iPod touch Spotlight search results and Settings icon) "Icon-Small-50.png", --50x50 (iPad 1 Spotlight search results and Settings icon) "Icon-Small-50@2x.png", --100x100 (RETINA iPads Spotlight search results and Settings icon) }, }, }, plugins = { ["CoronaProvider.native.popup.safariView"] = {publisherId = "com.coronalabs", supportedPlatforms = { iphone=true } }, }, }

Is there maybe a delay in the Corona website showing the plugin as activated (which it does) and the plugin really being activated and ready to use?

All help is much appreciated!

Thanks,

Thomas

An activated plugin should be available after a few seconds. I’ve asked that the documentation link get fixed.  I also copy/pasted your code above into a project and it worked as expected.  What version of iOS are you testing on? Or you just testing in the simulator?

Rob

Dang it Rob! You’re making me feel pretty silly now. :slight_smile: I am, as you might imagine, just testing in the simulator.

Is this something that is possible to emulate, by perhaps setting the build settings to “simulator = true”? I truly hope so, because this type of stuff (the Google Oauth calendar thing) requires a LOT of debugging trial and error to get the calls right, so building is too cumbersome. Or would you suggest doing a live build?

This is a great reason to use Live Builds.  The simulator simply can’t do things that there are only available for devices. 

Rob

Hmmmm… Is there really no other option? The simulator does offer the webView, which worked great for me, but with the Google Oauth changes coming up I’m forced to move to the SafariView window. I’ve got a specific “on the road” dev situation that makes using my laptop plus an iPad pretty unpractical - plus I output a LOT of code in the terminal, that I couldn’t do without, honestly…

An activated plugin should be available after a few seconds. I’ve asked that the documentation link get fixed.  I also copy/pasted your code above into a project and it worked as expected.  What version of iOS are you testing on? Or you just testing in the simulator?

Rob

Dang it Rob! You’re making me feel pretty silly now. :slight_smile: I am, as you might imagine, just testing in the simulator.

Is this something that is possible to emulate, by perhaps setting the build settings to “simulator = true”? I truly hope so, because this type of stuff (the Google Oauth calendar thing) requires a LOT of debugging trial and error to get the calls right, so building is too cumbersome. Or would you suggest doing a live build?

This is a great reason to use Live Builds.  The simulator simply can’t do things that there are only available for devices. 

Rob

Hmmmm… Is there really no other option? The simulator does offer the webView, which worked great for me, but with the Google Oauth changes coming up I’m forced to move to the SafariView window. I’ve got a specific “on the road” dev situation that makes using my laptop plus an iPad pretty unpractical - plus I output a LOT of code in the terminal, that I couldn’t do without, honestly…