yasirkula / UnityNativeShare

A Unity plugin to natively share files (images, videos, documents, etc.) and/or plain text on Android & iOS
MIT License
891 stars 131 forks source link

Attach multiple csv files - xCode error - Fixed #73

Closed LivioWW6 closed 4 years ago

LivioWW6 commented 4 years ago

Very good and simple tool. I just needed to export csv files that my educational game builds to store level times and other data. Doc's and examples are a bit thin but figured it all out in about an hour. Note that when I put mime type (text/csv) xCode gave an error due to a missing stringtype.mm file. FIXED this by using 'null' and letting the tool figure out the file type. It worked.

Here is part of the code to include in the docs. public string[] ListFiles = new string[4]; //I have 4 file paths

void Start() { VerifyCSVfiles(); //verify or build all CSV files-not shown //this also assigns the four file paths }

public void ShareButtonFile() { StartCoroutine(FileShare()); }

private IEnumerator FileShare()
{
    yield return new WaitForEndOfFrame();

    NativeShare share = new NativeShare();

    share.SetSubject("LizzyB Files");
    share.SetText("LizzyB file sharing");
    share.SetTitle("LizzyB file share...");

    for (int i = 0; i < ListFiles.Length; i++)
    {
        share.AddFile(ListFiles[i], null);
    }
    share.Share();
}

public void VerifyCSVfiles() {//verify files and get paths to each ..code not included } //just in case you are wondering about iOS vs Android file paths, this is called from the VerifyCSVfiles() method

string GetFilePath() { return GetDirectoryPath() + "/" + reportFileName; } string GetDirectoryPath() //iOS & android don't need the
//reportDirectoryName {

if UNITY_EDITOR

    return Application.dataPath + "/" + reportDirectoryName;
#elif UNITY_ANDROID
        return Application.persistentDataPath;
#elif UNITY_IOS
        return Application.persistentDataPath;
#else
        return Application.dataPath + "/" + reportDirectoryName;
#endif
}
yasirkula commented 4 years ago

The mime parameter isn't used in iOS, so I'm surprised to hear that. Maybe some other tweak have fixed this issue and coincidentally you have set the mime parameter to null at the same time?

LivioWW6 commented 4 years ago

Yes fixed with null. Included code example for you to include in documention.Gave 5 star review.Excellent tool and easy and clean.ThanxRealworldAdventures.com305.903.1732 -------- Original message --------From: Süleyman Yasir KULA notifications@github.com Date: 4/29/20 4:10 AM (GMT-05:00) To: yasirkula/UnityNativeShare UnityNativeShare@noreply.github.com Cc: worldwideinfo6 worldwideinfo6@gmail.com, Author author@noreply.github.com Subject: Re: [yasirkula/UnityNativeShare] Attach multiple csv files - xCode   error - Fixed (#73) The mime parameter isn't used in iOS, so I'm surprised to hear that. Maybe some other tweak have fixed this issue and coincidentally you have set the mime parameter to null at the same time?

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/yasirkula/UnityNativeShare/issues/73#issuecomment-621054370", "url": "https://github.com/yasirkula/UnityNativeShare/issues/73#issuecomment-621054370", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

yasirkula commented 4 years ago

Thank you for the review but as I said, the mime parameter isn't used on iOS. No matter what mime you pass, it won't affect the outcome on iOS. Most probably, another tweak you've made has resolved the issue.

LivioWW6 commented 4 years ago

hi

Yes, looks like you are correct. I added back the "text/csv" and did an iOS rebuild and this time xCode worked fine. So it must have been something else that I fixed without knowing.

Thanx

On Wed, Apr 29, 2020 at 11:28 AM Süleyman Yasir KULA < notifications@github.com> wrote:

Thank you for the review but as I said, the mime parameter isn't used on iOS. No matter what mime you pass, it won't affect the outcome on iOS. Most probably, another tweak you've made has resolved the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yasirkula/UnityNativeShare/issues/73#issuecomment-621285989, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOSPQQGPDNPKJAE7K6YVYDRPBBRLANCNFSM4MTJLQIQ .

--

Worldwide Waypoints, LLC US 305.903.1732 Italy +39 327 623 9800 Skype:Livio.Bestulic 3minuteAdventures.com for the Videos RealworldAdventures.com for the Stories LinkedIn Profile http://www.linkedin.com/pub/livio-bestulic/7/277/553

yasirkula commented 4 years ago

Glad the issue is resolved anyways 😄