- Home /
U3DXT Game Crashes when calling SocialXT.Share
Hello,
I have a button that calls the below code to open the iOS Activity Sheet for sharing to facebook etc.
public void OnSharePressed()
{
#if UNITY_IPHONE
SocialXT.Share(new object[]{"Example Message", "http://www.ExampleWebsite.co.uk"});
#endif
}
The Code compiles fine and iOS builds are successful.
However, when the button is pressed the game crashes on the SocailXT.Share method.
Unfortunately all I get from XCode is a EXC_BAD_ACCESS with the follwoing message.
0xb181c0: b 0xb18644 ; MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethod*, MonoObject*, MonoException*) + 1320 [inlined] mono_runtime_invoke_profiled(MonoMethod, MonoObject*, void*, MonoException, MonoClass) + 60 at MonoBehaviour.cpp:927
Does anyone have any ideas about what could be causing this?
Thanks in advance,
John
**EDIT - Updated code snippet to remove the SocailXT.ShareCompleted event (moved to Start()) as suggested below. This however was not the cause of the crash.
Any other ideas on why this might be happening - something I've missed in setting up the U3DXT plugin perhaps? Any further help would be greatly appreciated as this is a time critical project.
**EDIT - Unity answers wont let me attach the crash log so here is a drop box link to it.
I'm running Unity 4.3.3 and playing the game on an iPad Air 7.1.1
I can get the Demo working when running in a separate project. The only difference between that and our game is what happens at build time.
Because we have a shared code repository that is nested inside of our game repository and due to Unity not allowing you to have multiple Plugins folders we have to shift all our plugins into one folder within the project root at build time.
Does this plugin have any known conflicts with other plugins. The only one we use that I could think this may be the case with is Prime 31.
Answer by u3dxt · May 12, 2014 at 01:50 AM
Hi John, the SocailXT.ShareCompleted event needs to be subscribed only once. You would do that in your start or init function. Every time the button is pressed, you would just call SocialXT.Share(). Hope that helps.
Thanks for the reply. The above was a silly mistake on my behalf but unfortunately was not the cause of the crash.
Hi John, we are not able to reproduce this error. Can you give some more info? What Unity and iOS version are you using? What device are you on? Can you copy some more of the call stack when it crashes? Does the Assets/U3DXT/Examples/social/SocialTest demo work?
Thanks.
Thanks again for the reply. I've updated my post with the info you asked for.
Hi John, when building in Xcode, does it give you any warnings that start with "U3DXT" or "UP_"? We don't think there is any conflict with other plugins, but probably moving the files may be the cause. Also, from the call stack, it crashes at UIApplication.SharedApplication(), which is a very basic call. Have you changed the Unity Objective-C code?