Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

No share pop-up on IOS possible like on Android and the Notes IOS app?
Started by henrik5 Dec 19 2017 07:21 AM

11 replies to this topic
sharing caring facebook twitter native.showpopup
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

henrik5

[GLOBAL: userInfoPane.html]
henrik5
  • Contributor

  • 245 posts
  • Corona SDK

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?


[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,535 posts
  • Corona Staff

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.

 

Rob



[TOPIC: post.html]
#3

henrik5

[GLOBAL: userInfoPane.html]
henrik5
  • Contributor

  • 245 posts
  • Corona SDK

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.

Simulator%20Screen%20Shot%2020%20Dec%202
 


[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,535 posts
  • Corona Staff

The documentation is here:  https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_activity/index.html

 

It's in the Utility category instead of Social.

 

Rob



[TOPIC: post.html]
#5

henrik5

[GLOBAL: userInfoPane.html]
henrik5
  • Contributor

  • 245 posts
  • Corona SDK

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.



[TOPIC: post.html]
#6

vincenthawk

[GLOBAL: userInfoPane.html]
vincenthawk
  • Enthusiast

  • 35 posts
  • Corona SDK

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.

Hi Henrik,

I got the same situation here,
Did you find the way out?
Would you please share the sample code?

 

Best

 

Vincent
 



[TOPIC: post.html]
#7

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 6,973 posts
  • Corona SDK

Hey guys.  I did a talk about this long ago and posted some code for the Corona Geek hangout.

 

I think it still works, but you'll have to check.

 

1. Download this: https://github.com/roaminggamer/CoronaGeek/raw/master/Hangouts/SocialMedia.zip  (this code is from an old blog post on the site)

(from the larger repository: https://github.com/roaminggamer/CoronaGeek/tree/master/Hangouts )

 

2. CD to: SocialMedia\CoronaResources\fromBlogPosts\ios\activityPopup

 

3. Build and run the activityPopup code and install it on your device.

 

If it works, you may be able to grab what you need.  Also, there are other examples of features in that zip file.



[TOPIC: post.html]
#8

vincenthawk

[GLOBAL: userInfoPane.html]
vincenthawk
  • Enthusiast

  • 35 posts
  • Corona SDK

Hey guys.  I did a talk about this long ago and posted some code for the Corona Geek hangout.

 

I think it still works, but you'll have to check.

 

1. Download this: https://github.com/roaminggamer/CoronaGeek/raw/master/Hangouts/SocialMedia.zip  (this code is from an old blog post on the site)

(from the larger repository: https://github.com/roaminggamer/CoronaGeek/tree/master/Hangouts )

 

2. CD to: SocialMedia\CoronaResources\fromBlogPosts\ios\activityPopup

 

3. Build and run the activityPopup code and install it on your device.

 

If it works, you may be able to grab what you need.  Also, there are other examples of features in that zip file.

Hi roaminggamer,

Thanks for your information.

I've download the code and it seems nearly to be ok but the system ask user to login to FB first.

29063348_1474575839337068_57021023915291
I've use the facebookLogin() function of the "plugin.facebook.v4a" but it still ask for fb login first.

Would you please take a look for me or any advisement?

 

 

Vincent



[TOPIC: post.html]
#9

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 6,973 posts
  • Corona SDK

I'm afraid I can't help much.  I merely wanted to offer access to the old examples in case there was something that could be dusted off and used there.

 

As far as FB, I think the credentials must be stored in different places which is why the login isn't working as expected.

 

Also, which example did you run?  There were several in the linked file.



[TOPIC: post.html]
#10

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,535 posts
  • Corona Staff

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.

 

Rob



[TOPIC: post.html]
#11

vincenthawk

[GLOBAL: userInfoPane.html]
vincenthawk
  • Enthusiast

  • 35 posts
  • Corona SDK

I'm afraid I can't help much.  I merely wanted to offer access to the old examples in case there was something that could be dusted off and used there.

 

As far as FB, I think the credentials must be stored in different places which is why the login isn't working as expected.

 

Also, which example did you run?  There were several in the linked file.

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

just like this post : https://forums.coronalabs.com/topic/65047-trouble-using-social-plugin-to-post-photo-on-facebook/?hl=%2Bshare+%2Bphoto+%2Bto+%2Bfacebook#entry336056

 

 

Best



[TOPIC: post.html]
#12

vincenthawk

[GLOBAL: userInfoPane.html]
vincenthawk
  • Enthusiast

  • 35 posts
  • Corona SDK

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.

 

Rob

Hi Rob,
Thanks a lot!
You are right, I didn't login to the FB APP, after I did, it works!!

Best




[topic_controls]
[/topic_controls]