if (system.getInfo("environment") == "device") then local platformName = system.getInfo("platformName") if platformName == "Android" then share\_on\_android() else share\_on\_ios() end end
The share_on_ios() function has:
function share\_on\_ios () local itemsToShare = { { type = "image", value = { filename = "social\_media.png", baseDir = system.DocumentsDirectory } }, { type = "url", value = "http://www.gameforkstudio.com" }, } local options = { items=itemsToShare, listener=popupListener } local activity = require( "CoronaProvider.native.popup.activity" ) native.showPopup( "activity", options ) end
Is there anything else I need to add to my code to include the popup plugin into the app?
The social popup on iOS is for iOS 7 and earlier. It should not be used on modern iOS devices. Activity is the one you should be using.
Can you make a .zip file with your build.settings, config.lua and main.lua and a simple button to show the popup and share it here? You probably should upload the .zip file to some place like Dropbox or Google Drive and share it to get a URL and post the URL here.
As requested, a zip file with a simple app was created. It shows an image of a cat. When you click on the cat, it should share the image but instead I get a crash.
The problem is in your build.settings file. You have this:
supportedPlatforms={"iphone"}
when it should be:
supportedPlatforms={iphone = true}
In your version you’re creating a table named supportedPlatforms, which is being treated as a numerically indexed array and supportedPlatorms[1] = the string “iphone”. However we are expecting a table that contains key-value pairs that’s indexed by the key. In the second version the key is “iphone” and the value is true.
Make that change and the activity popup will work exactly as expected.