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

Error with sharing #152

Open
zeeshanqaswar1221 opened this issue Oct 11, 2022 · 13 comments
Open

Error with sharing #152

zeeshanqaswar1221 opened this issue Oct 11, 2022 · 13 comments

Comments

@zeeshanqaswar1221
Copy link

image

I am using this block of code to share my json file on Ipad. When I am on the main dialogue Only one json file with a name is being appeared and I am also checking the number of files I have in files list while doing this
image

But the problem is when I press "Save to Files" It adds an additional file of "text.txt" so as result it saves two files on the drive instead of just my exported json file.

I am confused why is this happening. To test my case what I did was I tried to mail and copy the file and it was not adding any extra files Instead I was getting the only file that I was wanted which is the desired result.

@yasirkula
Copy link
Owner

Is it possible that the file is renamed to text.txt and the other json file was already there before?

@zeeshanqaswar1221
Copy link
Author

My code is quite straight forward and I personally don't see it happening at the Unity level. I am not sure about whether its happening on the plugin side or not.

@yasirkula
Copy link
Owner

I've seen entries mentioning the saved file automatically being renamed to text.txt but never seen any entries where text.txt was duplicated. Please delete both text.txt and the other json file and try again.

@zeeshanqaswar1221
Copy link
Author

Can you tell me how can I verify on my side like where it's being renamed to text.txt?

@zeeshanqaswar1221
Copy link
Author

Like I mentioned earlier its only happened when I press "save to folder " in dialogue box besides that if try to copy or save to note in Ipad it shows me one file

@yasirkula
Copy link
Owner

Can you tell me how can I verify on my side like where it's being renamed to text.txt?

You can verify it by deleting txt and json from the folder and saving to that folder again. If only txt exists, then the file is renamed.

@zeeshanqaswar1221
Copy link
Author

there is only one file in the folder I Debuged the path of file when pressing the AddFile Event in Xcode and its only one call to addFile and one debug

@yasirkula
Copy link
Owner

What I'm trying to say is, if when you click the "Save to Files" button, you are saving the file to say X folder, then please delete both txt and json from that X folder and try again. I'm suspecting that the json file in the X folder was present there beforehand and that made you think that calling Share function added both a json and a txt file to X folder whereas in reality, it only added a txt file to the X folder.

@zeeshanqaswar1221
Copy link
Author

zeeshanqaswar1221 commented Oct 13, 2022

No! I totally understand your Point when I try to click "Save to Files" button at the time "X Folder " which I am pointing to is totally empty. When you press "Save to Files" it shows me that on top of "2 Items" and the I proceeded to select X folder which is right below the name.

@zeeshanqaswar1221
Copy link
Author

and I only sent one call to Add a file in Unity which I debugged in Xcode and is precisely only one call and the path I use in AddFile() method is exactly the path to JSON file. What I am confused about is where did this "text.txt" file come from When I am not even creating this file. Is this something happening at plugin level?

@zeeshanqaswar1221
Copy link
Author

zeeshanqaswar1221 commented Oct 13, 2022

Thanks after So many hits and trials
Inked195060612-08028f65-009a-4ffe-9fd4-58c1f949606d

I removed these two lines and my problem is solved now its not adding any additional text.txt file and It was happening at the plugin level. Between Thanks for your Support.

@yasirkula
Copy link
Owner

Thank you for letting me know about this. I believe you can use SetCallback without any issues. This must be related to SetSubject only. I'll research some more to see how it can be resolved.

@yasirkula
Copy link
Owner

yasirkula commented Oct 13, 2022

Can you change these lines with the following code (you can do that in Xcode by modifying NativeShare.mm for testing purposes) and see if it resolves the issue:

- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType
{
	return [activityType isEqualToString:@"com.apple.CloudDocsUI.AddToiCloudDrive"] ? nil : [self body];
}

- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType
{
	return [activityType isEqualToString:@"com.apple.CloudDocsUI.AddToiCloudDrive"] ? nil : [self subject];
}

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

2 participants