Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

IOS 11.3 #9

Open
svisveswar001 opened this issue Apr 18, 2018 · 21 comments
Open

IOS 11.3 #9

svisveswar001 opened this issue Apr 18, 2018 · 21 comments

Comments

@svisveswar001
Copy link

Share stopped working with IOS 11.3. The Share dialog box does not appear anymore. Code works fine in older IOS versions.

@yasirkula
Copy link
Owner

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
});

Credit: https://stackoverflow.com/a/46832604/2373034

@svisveswar001
Copy link
Author

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.

@yasirkula
Copy link
Owner

So, did you find anything useful? :)

@chadidi
Copy link

chadidi commented Jun 27, 2018

I have the same problem when are you going to commit a fix @yasirkula Thanks ;)

@chadidi
Copy link

chadidi commented Jun 27, 2018

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. 🤯

@yasirkula
Copy link
Owner

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?

@chadidi
Copy link

chadidi commented Jun 27, 2018

@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(); }

@yasirkula
Copy link
Owner

yasirkula commented Jun 27, 2018

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.

@chadidi
Copy link

chadidi commented Jun 27, 2018

@yasirkula After i build the code removed from the file and still the same should i add it to AndroidManifest-main.xml

@yasirkula
Copy link
Owner

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/.

@bigvanstudio
Copy link

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!

@yasirkula
Copy link
Owner

Are there any error messages in the console? And are you testing on an iPhone or an iPad?

@bigvanstudio
Copy link

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, EventFunction1)
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)

@yasirkula
Copy link
Owner

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!

@bigvanstudio
Copy link

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, EventFunction1)
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)

@yasirkula
Copy link
Owner

You need to add Share(); to the end of the NativeShare object; e.g. new NativeShare().AddFile(GlobalVariables.lastVideoPath).Share();

@bigvanstudio
Copy link

WOW!! What a rookie's mistake! I apologize!!
It works perfectly well!!
Many, many thanks!! really!

@yasirkula
Copy link
Owner

You are welcome!

@gblikas
Copy link

gblikas commented Nov 27, 2019

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.

@yasirkula
Copy link
Owner

I'm happy to hear that but still a little confused because the mime parameter is not used on iOS:

#elif UNITY_ANDROID
AJC.CallStatic( "Share", Context, targetPackage, targetClass, files.ToArray(), mimes.ToArray(), subject, text, title );
#elif UNITY_IOS
_NativeShare_Share( files.ToArray(), files.Count, subject, text );

@gblikas
Copy link

gblikas commented Nov 28, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants