Open svisveswar001 opened 6 years ago
Do you get a specific error message? Does wrapping lines 31 to 40 with the following solve the issue:
dispatch_async(dispatch_get_main_queue(), ^{
// lines 31-40
});
Thanks so much! I tried your suggestion and it worked. But I also found on another iPhone with 11.3 it works without the above change. So I am not even sure what the issue is. I am trying to debug now with and without change on Xcode. I will post an update shortly.
So, did you find anything useful? :)
I have the same problem when are you going to commit a fix @yasirkula Thanks ;)
I used the project from unity store and it worked, but why the code is different I downloaded a plugin with same name 1 month ago but when i opened them the code was very different. 🤯
I don't update Asset Store versions of my plugins very often (guess I'm lazy), but for NativeShare, there shouldn't be much of a difference, if any. Maybe you downloaded a different plugin like this?
@yasirkula Yeah maybe i have downloaded another plugin!!
And also I have another problem is that it's not working on android.
but when i test it on Unity Editor i can see in the log that it prints 'Shared'.
This is my method
public void Share() { NativeShare myNativeShare = new NativeShare(); if (myNativeShare == null) { Debug.Log("shared failed(?)"); return; } myNativeShare.SetTitle("Share our new phone with the world"); myNativeShare.AddFile(filePath); myNativeShare.Share(); }
Does the share dialog not show at all on Android? If so, are there any error messages on Logcat? After you build your project to Android, can you navigate to PROJECT_PATH/Temp/StagingArea/AndroidManifest.xml and copy&paste its <provider ... />
tag here?
P.S. It would be better to open a new issue the next time to keep things more organized.
@yasirkula After i build the code removed from the file and still the same should i add it to AndroidManifest-main.xml
The provider tag must be placed inside Assets/Plugins/Android/AndroidManifest.xml. If your AndroidManifest is located elsewhere, you should move it to Assets/Plugins/Android/.
Hi! First of all, many thanks for the plugin! I have tested it on iOS 11.4 and it does not work even adding the "dispatch_async" code. Any solution? Thanks in advance!
Are there any error messages in the console? And are you testing on an iPhone or an iPad?
Hi, Thanks for your fast reply. I am testing in on an iPhone 7. I am trying to share a just recorded video. Thanks for yr support. This is what I see on the console:
Share video. Path:/var/mobile/Containers/Data/Application/4D665B07-56F9-497D-8FEB-BF8CBAAE7A7D/Documents/recording_2018_07_05_16_11_08_554.mov
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
RecordVideoNatCorder:ShareVideo()
UnityEngine.Events.UnityAction:Invoke()
UnityEngine.Events.InvokableCall:Invoke()
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.UI.Button:Press()
UnityEngine.UI.Button:OnPointerClick(PointerEventData)
UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData)
UnityEngine.EventSystems.EventFunction1:Invoke(T1, BaseEventData) UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction
1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()
UnityEngine.EventSystems.EventSystem:Update()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
What happens when you try to share the video? Does the share dialog not show up at all? If the dialog does show up, try sharing without any text/subject and see if it changes anything. Also insert Debug.Log( "Video exists: " + File.Exists( videoPath ) );
to your script and see if it returns true (maybe processing the video takes a couple of seconds). Can I also see your ShareVideo function? Thanks!
Nothing happens.. This is the ShareVideo function:
public void ShareVideo(){ Debug.Log("Share video. Path:" + GlobalVariables.lastVideoPath); Debug.Log("Video exists: " + File.Exists(GlobalVariables.lastVideoPath)); //new NativeShare().AddFile(GlobalVariables.lastVideoPath).SetSubject("Subject text").SetText("Hello World!"); new NativeShare().AddFile(GlobalVariables.lastVideoPath); }
This is what I see on the console when the function is called:
Share video. Path:/var/mobile/Containers/Data/Application/4291CAD2-E57E-410A-BF57-5303A3EE2237/Documents/recording_2018_07_05_16_41_33_064.mov
Video exists: True
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
RecordVideoNatCorder:ShareVideo()
UnityEngine.Events.UnityAction:Invoke()
UnityEngine.Events.InvokableCall:Invoke()
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.UI.Button:Press()
UnityEngine.UI.Button:OnPointerClick(PointerEventData)
UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData)
UnityEngine.EventSystems.EventFunction1:Invoke(T1, BaseEventData) UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction
1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()
UnityEngine.EventSystems.EventSystem:Update()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
You need to add Share(); to the end of the NativeShare object; e.g. new NativeShare().AddFile(GlobalVariables.lastVideoPath).Share();
WOW!! What a rookie's mistake! I apologize!! It works perfectly well!! Many, many thanks!! really!
You are welcome!
A little late, but I had some initial trouble with sharing a simple text file on iOS 11.3, and it turned out that I needed to include the mime
type when declaring specifying the file.
Also, on iOS 13, the code seems to run just great.
I'm happy to hear that but still a little confused because the mime parameter is not used on iOS: https://github.com/yasirkula/UnityNativeShare/blob/adb30521ac7ed0d0fecad643efbfe2bdd70ea6db/Plugins/NativeShare/NativeShare.cs#L125-L128
Haha, I actually changed the file extension I think. I went from a .log
to a .txt
, and it gave me a few more options for sharing, most of which work.
Share stopped working with IOS 11.3. The Share dialog box does not appear anymore. Code works fine in older IOS versions.