On Android, I use native.showPopup(“social”,options), and the social network/SMS/Mail selector pops up as normal. The URL to be shared is passed in options.
Built-in IOS apps seem to have a similar social network selector popup, but this selector seems unavailable in unavailable to third-party apps, either for all frameworks or just the Corona framework.
Currently I handle this by allowing only Facebook on IOS, which is a compromise that I would like removed.
Here’s the code I use:
shareFacebook=function(msg,picfname,picdir,url2)local serviceName = "facebook" local isAvailable = true --default for IOS, do not ask if \_MODEL=="Android" then isAvailable=native.canShowPopup( "social", serviceName ) end if ( isAvailable ) then local listener = {} function listener:popup( event ) dprint( "name: " .. event.name ) dprint( "type: " .. event.type ) dprint( "action: " .. tostring( event.action ) ) dprint( "limitReached: " .. tostring( event.limitReached ) ) end native.showPopup( "social", { service = serviceName, listener = listener, url = url2 }) else native.showAlert( "Kan inte skicka " .. serviceName .. "-meddelande!", "Om du har Facebookappen, kontrollera att du är inloggad under Inställningar \> Facebook \> Konto för att kunna dela.", { "OK" } ) end end
Question: I could make a pop-up selector for the networks Corona supports, but is there a way to trigger the IOS selector?
You should use the “activity” plugin (which is part of native.showPopup()) which is the iOS way of accessing email, SMS, and social networks. The “social” plugin really just works for Android.
The activity plugin is not documented, and I didn’t find anything substantial from a web search, a search on this forum or in the SDK code examples. Should the below guessed code work? Just substitute “social” for “activity” on IOS? It gives the attached screenshot in the IOS Simulator.
I expected to see some options there for IOS apps, but there are none. Is the reason that none of them is set up? Unfortunately I don’t have a test device available at the moment.
shareMsgUrl=function(msg,url) local popupType="social" if \_MODEL~="Android" then popupType="activity" end isAvailable=native.canShowPopup( popupType ) if (isAvailable) then local listener = {} function listener:popup( event ) dprint( "name: " .. event.name ) dprint( "type: " .. event.type ) dprint( "action: " .. tostring( event.action ) ) dprint( "limitReached: " .. tostring( event.limitReached ) ) end native.showPopup( popupType, { listener = listener, url = url }) else native.showAlert( "Sharing error", "Sharing unavailable!", { "OK" } ) end end
Thanks,
Henrik.
Edit: The above code does not work. It gives the same result as in the Simulator on an Iphone with IOS 11, and Facebook and Mail installed and configured. I.e. the network selector is not populated with social network icons.
Thx Rob. I guess the problem was the separate documentation pages with no link between the two and no mention/gotcha that on IOS you use the utility plugin. I visited that page but since I had the native.showPopup() documentation open I never clicked the link there to get to the “activity showPopup” documentation.
You actually have to be logged into the social network services native app to use the iOS controls. That is you have to install and be logged in to Twitter to use Twitter from the activity plugin. You have to be logged into the Facebook app to use Facebook from the activity plugin.
Thank you so much , I finally get this done.
I used this sample code : activityPopup
The trick is : not put the URL into the item, or the dialog will show only the url instead of image
You should use the “activity” plugin (which is part of native.showPopup()) which is the iOS way of accessing email, SMS, and social networks. The “social” plugin really just works for Android.
The activity plugin is not documented, and I didn’t find anything substantial from a web search, a search on this forum or in the SDK code examples. Should the below guessed code work? Just substitute “social” for “activity” on IOS? It gives the attached screenshot in the IOS Simulator.
I expected to see some options there for IOS apps, but there are none. Is the reason that none of them is set up? Unfortunately I don’t have a test device available at the moment.
shareMsgUrl=function(msg,url) local popupType="social" if \_MODEL~="Android" then popupType="activity" end isAvailable=native.canShowPopup( popupType ) if (isAvailable) then local listener = {} function listener:popup( event ) dprint( "name: " .. event.name ) dprint( "type: " .. event.type ) dprint( "action: " .. tostring( event.action ) ) dprint( "limitReached: " .. tostring( event.limitReached ) ) end native.showPopup( popupType, { listener = listener, url = url }) else native.showAlert( "Sharing error", "Sharing unavailable!", { "OK" } ) end end
Thanks,
Henrik.
Edit: The above code does not work. It gives the same result as in the Simulator on an Iphone with IOS 11, and Facebook and Mail installed and configured. I.e. the network selector is not populated with social network icons.
Thx Rob. I guess the problem was the separate documentation pages with no link between the two and no mention/gotcha that on IOS you use the utility plugin. I visited that page but since I had the native.showPopup() documentation open I never clicked the link there to get to the “activity showPopup” documentation.