- Home /
Social features for iOS?
Hello, What would I do first if I want to have email, facebook and twitter integration (having pre-set messages/posts that the player can send from within the game) in my unity iOS game(anyone know of any good tutorials)?
Answer by Voxel-Busters · Aug 12, 2015 at 09:06 AM
There is no direct method in unity to do that. As, its native feature and Unity being cross-platform engine.
If you want to do that you need to use
Share sheet on iOS.
Intent Chooser with required types.
For this reason we developed Cross Platform Native Plugins for both iOS and Android with a unified API. It has sharing features along with other mostly used features (Notifications, Billing & many more).
Sharing feature is completely available for FREE in Lite version . Grab it and source code is included to have a look.
Sharing feature contains following functionalities
Share image, text,url via SMS
Share image, text,url via E-Mail
Share image, text,url via Whats-app
Share image, text,url on Social Network (Facebook, Twitter)
Adding to it we added separate Twitter SDK feature in full version.
Answer by Peter G · Apr 10, 2011 at 08:14 PM
Most iOS plugins are designed to work very similarly. Here is the general path.
Bring the facebook/twitter plugin into xCode.
You have to create a wrapper class. This isn't that hard. This class allocates an object for managing for your messaging. This just encapsulates your direct message handlers. There is a very high chance this code will be written in Objective-C.
Create a collection of static methods outside your class wrapped in
extern "C" {}
This code will probably be in Objective-C++ (method declarations will have C syntax). This is the most flexible part of the implementation. Some how you will create an instance of your class from the previous step. Then you will call its methods[myInstance sendMessageToFeed:(Facebook*)fbPointer message:(NSString*)messageToPost];
Assuming that your class will respond to those messages.In Unity, create a plugin manager that acts as yet another wrapper. Use
[DllImport("_Internal")];
to link to your plugin.Call your plugins through Unity functions and it will pass the function to unmanaged code.
The Bonjour client tutorial demonstrates the process fairly well. See Twitter and Facebook's developer documentation for their specific process of setting up your pointers and sending messages.
Your answer
Follow this Question
Related Questions
social network & share function 4 Answers
API for posting to all social networks for all platforms 2 Answers
[iOS] Display the Activity Window to Share a Score 1 Answer
U3DXT Social FacebookPost not Working? 1 Answer
Xcode hook up with Unity 1 Answer