Xamarin ios Cloud file copy location issue





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I had connected iCloud using xamarin forms ios. My file copied to icloud without any error. But it saved in file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~companyname~MobileDoc/ path.



When i checked inside iCloud my file not showing it. But when i search that file, its location shows as iCloud --> MobileDoc--> File.txt. But when i checked inside the iCloud there are no Folder call MobileDoc.



This is the example i tried Here



This is the code i am using to save the document.



var uburl = NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null);

if (uburl == null)
{
HasiCloud = false;
}
else
{
HasiCloud = true;
iCloudUrl = uburl;

var docsFolder = Path.Combine(iCloudUrl.Path, "Documents");
var filePath = Path.Combine(docsFolder, fileName);

FileService.Save(filePath, attachment.Content);
if (option == false)
FileService.Instance.Open(filePath);
}









share|improve this question

























  • You mean that save file to icloud success,but can not read file there?

    – Junior Jiang - MSFT
    Nov 30 '18 at 8:07











  • @Junior Jiang - MSFT File not Not visible.

    – amnk
    Nov 30 '18 at 8:12











  • If i find my saved file inside the mac it shows in search window. Location is inside the cloud. but if i checked the iCloud its not visible. I don't know what mistakes i did

    – amnk
    Nov 30 '18 at 8:14











  • Make sure that icloud have data there.When you save data to icloud , you can use NSMetadataQuery to check file.

    – Junior Jiang - MSFT
    Nov 30 '18 at 8:48











  • icloud have manually uploaded files. not visible only uploaded using xamarin ios

    – amnk
    Nov 30 '18 at 10:40


















1















I had connected iCloud using xamarin forms ios. My file copied to icloud without any error. But it saved in file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~companyname~MobileDoc/ path.



When i checked inside iCloud my file not showing it. But when i search that file, its location shows as iCloud --> MobileDoc--> File.txt. But when i checked inside the iCloud there are no Folder call MobileDoc.



This is the example i tried Here



This is the code i am using to save the document.



var uburl = NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null);

if (uburl == null)
{
HasiCloud = false;
}
else
{
HasiCloud = true;
iCloudUrl = uburl;

var docsFolder = Path.Combine(iCloudUrl.Path, "Documents");
var filePath = Path.Combine(docsFolder, fileName);

FileService.Save(filePath, attachment.Content);
if (option == false)
FileService.Instance.Open(filePath);
}









share|improve this question

























  • You mean that save file to icloud success,but can not read file there?

    – Junior Jiang - MSFT
    Nov 30 '18 at 8:07











  • @Junior Jiang - MSFT File not Not visible.

    – amnk
    Nov 30 '18 at 8:12











  • If i find my saved file inside the mac it shows in search window. Location is inside the cloud. but if i checked the iCloud its not visible. I don't know what mistakes i did

    – amnk
    Nov 30 '18 at 8:14











  • Make sure that icloud have data there.When you save data to icloud , you can use NSMetadataQuery to check file.

    – Junior Jiang - MSFT
    Nov 30 '18 at 8:48











  • icloud have manually uploaded files. not visible only uploaded using xamarin ios

    – amnk
    Nov 30 '18 at 10:40














1












1








1








I had connected iCloud using xamarin forms ios. My file copied to icloud without any error. But it saved in file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~companyname~MobileDoc/ path.



When i checked inside iCloud my file not showing it. But when i search that file, its location shows as iCloud --> MobileDoc--> File.txt. But when i checked inside the iCloud there are no Folder call MobileDoc.



This is the example i tried Here



This is the code i am using to save the document.



var uburl = NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null);

if (uburl == null)
{
HasiCloud = false;
}
else
{
HasiCloud = true;
iCloudUrl = uburl;

var docsFolder = Path.Combine(iCloudUrl.Path, "Documents");
var filePath = Path.Combine(docsFolder, fileName);

FileService.Save(filePath, attachment.Content);
if (option == false)
FileService.Instance.Open(filePath);
}









share|improve this question
















I had connected iCloud using xamarin forms ios. My file copied to icloud without any error. But it saved in file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~companyname~MobileDoc/ path.



When i checked inside iCloud my file not showing it. But when i search that file, its location shows as iCloud --> MobileDoc--> File.txt. But when i checked inside the iCloud there are no Folder call MobileDoc.



This is the example i tried Here



This is the code i am using to save the document.



var uburl = NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null);

if (uburl == null)
{
HasiCloud = false;
}
else
{
HasiCloud = true;
iCloudUrl = uburl;

var docsFolder = Path.Combine(iCloudUrl.Path, "Documents");
var filePath = Path.Combine(docsFolder, fileName);

FileService.Save(filePath, attachment.Content);
if (option == false)
FileService.Instance.Open(filePath);
}






ios xamarin icloud icloud-drive






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 30 '18 at 3:06







amnk

















asked Nov 29 '18 at 2:34









amnkamnk

215




215













  • You mean that save file to icloud success,but can not read file there?

    – Junior Jiang - MSFT
    Nov 30 '18 at 8:07











  • @Junior Jiang - MSFT File not Not visible.

    – amnk
    Nov 30 '18 at 8:12











  • If i find my saved file inside the mac it shows in search window. Location is inside the cloud. but if i checked the iCloud its not visible. I don't know what mistakes i did

    – amnk
    Nov 30 '18 at 8:14











  • Make sure that icloud have data there.When you save data to icloud , you can use NSMetadataQuery to check file.

    – Junior Jiang - MSFT
    Nov 30 '18 at 8:48











  • icloud have manually uploaded files. not visible only uploaded using xamarin ios

    – amnk
    Nov 30 '18 at 10:40



















  • You mean that save file to icloud success,but can not read file there?

    – Junior Jiang - MSFT
    Nov 30 '18 at 8:07











  • @Junior Jiang - MSFT File not Not visible.

    – amnk
    Nov 30 '18 at 8:12











  • If i find my saved file inside the mac it shows in search window. Location is inside the cloud. but if i checked the iCloud its not visible. I don't know what mistakes i did

    – amnk
    Nov 30 '18 at 8:14











  • Make sure that icloud have data there.When you save data to icloud , you can use NSMetadataQuery to check file.

    – Junior Jiang - MSFT
    Nov 30 '18 at 8:48











  • icloud have manually uploaded files. not visible only uploaded using xamarin ios

    – amnk
    Nov 30 '18 at 10:40

















You mean that save file to icloud success,but can not read file there?

– Junior Jiang - MSFT
Nov 30 '18 at 8:07





You mean that save file to icloud success,but can not read file there?

– Junior Jiang - MSFT
Nov 30 '18 at 8:07













@Junior Jiang - MSFT File not Not visible.

– amnk
Nov 30 '18 at 8:12





@Junior Jiang - MSFT File not Not visible.

– amnk
Nov 30 '18 at 8:12













If i find my saved file inside the mac it shows in search window. Location is inside the cloud. but if i checked the iCloud its not visible. I don't know what mistakes i did

– amnk
Nov 30 '18 at 8:14





If i find my saved file inside the mac it shows in search window. Location is inside the cloud. but if i checked the iCloud its not visible. I don't know what mistakes i did

– amnk
Nov 30 '18 at 8:14













Make sure that icloud have data there.When you save data to icloud , you can use NSMetadataQuery to check file.

– Junior Jiang - MSFT
Nov 30 '18 at 8:48





Make sure that icloud have data there.When you save data to icloud , you can use NSMetadataQuery to check file.

– Junior Jiang - MSFT
Nov 30 '18 at 8:48













icloud have manually uploaded files. not visible only uploaded using xamarin ios

– amnk
Nov 30 '18 at 10:40





icloud have manually uploaded files. not visible only uploaded using xamarin ios

– amnk
Nov 30 '18 at 10:40












1 Answer
1






active

oldest

votes


















0














Saving iCloud Documents



To add a UIDocument to iCloud you can call UIDocument.Save directly (for new documents only) or move an existing file using NSFileManager.DefaultManager.SetUbiquitious. The example code creates a new document directly in the ubiquity container with this code (there are two completion handlers here, one for the Save operation and another for the Open):



var docsFolder = Path.Combine (iCloudUrl.Path, "Documents"); // NOTE: Documents folder is user-accessible in Settings
var docPath = Path.Combine (docsFolder, MonkeyDocFilename);
var ubiq = new NSUrl (docPath, false);
var monkeyDoc = new MonkeyDocument (ubiq);
monkeyDoc.Save (monkeyDoc.FileUrl, UIDocumentSaveOperation.ForCreating, saveSuccess => {
Console.WriteLine ("Save completion:" + saveSuccess);
if (saveSuccess) {
monkeyDoc.Open (openSuccess => {
Console.WriteLine ("Open completion:" + openSuccess);
if (openSuccess) {
Console.WriteLine ("new document for iCloud");
Console.WriteLine (" == " + monkeyDoc.DocumentString);
viewController.DisplayDocument (monkeyDoc);
} else {
Console.WriteLine ("couldn't open");
}
});
} else {
Console.WriteLine ("couldn't save");
}


According to document ,when you save file to icloud,you need to use UIDocument .This will be Safe and stable.






share|improve this answer
























  • Thanks for reply. I had added your code and save the document using UIDocument as you said. file is saved inside the path Library --> Mobile Documents ({file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~company name~MobileA/Documents/SJA%20V001-2.pdf}) . But not visible in iCloud. Please help

    – amnk
    Dec 3 '18 at 5:29













  • is there anything to do to view iCloud syncrnozation file view in icloud?

    – amnk
    Dec 3 '18 at 5:37











  • Suggesting that you can try with saving a txt file like demo in document,and check it whether work.

    – Junior Jiang - MSFT
    Dec 4 '18 at 9:56











  • Yeh i Tried. its also going to this path.

    – amnk
    Dec 4 '18 at 11:12











  • Ok, also can not be saw in iCloud?Suggest that using NSMetadataQuery to get your icloud file list,it will show all file.

    – Junior Jiang - MSFT
    Dec 5 '18 at 1:16












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53531009%2fxamarin-ios-cloud-file-copy-location-issue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Saving iCloud Documents



To add a UIDocument to iCloud you can call UIDocument.Save directly (for new documents only) or move an existing file using NSFileManager.DefaultManager.SetUbiquitious. The example code creates a new document directly in the ubiquity container with this code (there are two completion handlers here, one for the Save operation and another for the Open):



var docsFolder = Path.Combine (iCloudUrl.Path, "Documents"); // NOTE: Documents folder is user-accessible in Settings
var docPath = Path.Combine (docsFolder, MonkeyDocFilename);
var ubiq = new NSUrl (docPath, false);
var monkeyDoc = new MonkeyDocument (ubiq);
monkeyDoc.Save (monkeyDoc.FileUrl, UIDocumentSaveOperation.ForCreating, saveSuccess => {
Console.WriteLine ("Save completion:" + saveSuccess);
if (saveSuccess) {
monkeyDoc.Open (openSuccess => {
Console.WriteLine ("Open completion:" + openSuccess);
if (openSuccess) {
Console.WriteLine ("new document for iCloud");
Console.WriteLine (" == " + monkeyDoc.DocumentString);
viewController.DisplayDocument (monkeyDoc);
} else {
Console.WriteLine ("couldn't open");
}
});
} else {
Console.WriteLine ("couldn't save");
}


According to document ,when you save file to icloud,you need to use UIDocument .This will be Safe and stable.






share|improve this answer
























  • Thanks for reply. I had added your code and save the document using UIDocument as you said. file is saved inside the path Library --> Mobile Documents ({file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~company name~MobileA/Documents/SJA%20V001-2.pdf}) . But not visible in iCloud. Please help

    – amnk
    Dec 3 '18 at 5:29













  • is there anything to do to view iCloud syncrnozation file view in icloud?

    – amnk
    Dec 3 '18 at 5:37











  • Suggesting that you can try with saving a txt file like demo in document,and check it whether work.

    – Junior Jiang - MSFT
    Dec 4 '18 at 9:56











  • Yeh i Tried. its also going to this path.

    – amnk
    Dec 4 '18 at 11:12











  • Ok, also can not be saw in iCloud?Suggest that using NSMetadataQuery to get your icloud file list,it will show all file.

    – Junior Jiang - MSFT
    Dec 5 '18 at 1:16
















0














Saving iCloud Documents



To add a UIDocument to iCloud you can call UIDocument.Save directly (for new documents only) or move an existing file using NSFileManager.DefaultManager.SetUbiquitious. The example code creates a new document directly in the ubiquity container with this code (there are two completion handlers here, one for the Save operation and another for the Open):



var docsFolder = Path.Combine (iCloudUrl.Path, "Documents"); // NOTE: Documents folder is user-accessible in Settings
var docPath = Path.Combine (docsFolder, MonkeyDocFilename);
var ubiq = new NSUrl (docPath, false);
var monkeyDoc = new MonkeyDocument (ubiq);
monkeyDoc.Save (monkeyDoc.FileUrl, UIDocumentSaveOperation.ForCreating, saveSuccess => {
Console.WriteLine ("Save completion:" + saveSuccess);
if (saveSuccess) {
monkeyDoc.Open (openSuccess => {
Console.WriteLine ("Open completion:" + openSuccess);
if (openSuccess) {
Console.WriteLine ("new document for iCloud");
Console.WriteLine (" == " + monkeyDoc.DocumentString);
viewController.DisplayDocument (monkeyDoc);
} else {
Console.WriteLine ("couldn't open");
}
});
} else {
Console.WriteLine ("couldn't save");
}


According to document ,when you save file to icloud,you need to use UIDocument .This will be Safe and stable.






share|improve this answer
























  • Thanks for reply. I had added your code and save the document using UIDocument as you said. file is saved inside the path Library --> Mobile Documents ({file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~company name~MobileA/Documents/SJA%20V001-2.pdf}) . But not visible in iCloud. Please help

    – amnk
    Dec 3 '18 at 5:29













  • is there anything to do to view iCloud syncrnozation file view in icloud?

    – amnk
    Dec 3 '18 at 5:37











  • Suggesting that you can try with saving a txt file like demo in document,and check it whether work.

    – Junior Jiang - MSFT
    Dec 4 '18 at 9:56











  • Yeh i Tried. its also going to this path.

    – amnk
    Dec 4 '18 at 11:12











  • Ok, also can not be saw in iCloud?Suggest that using NSMetadataQuery to get your icloud file list,it will show all file.

    – Junior Jiang - MSFT
    Dec 5 '18 at 1:16














0












0








0







Saving iCloud Documents



To add a UIDocument to iCloud you can call UIDocument.Save directly (for new documents only) or move an existing file using NSFileManager.DefaultManager.SetUbiquitious. The example code creates a new document directly in the ubiquity container with this code (there are two completion handlers here, one for the Save operation and another for the Open):



var docsFolder = Path.Combine (iCloudUrl.Path, "Documents"); // NOTE: Documents folder is user-accessible in Settings
var docPath = Path.Combine (docsFolder, MonkeyDocFilename);
var ubiq = new NSUrl (docPath, false);
var monkeyDoc = new MonkeyDocument (ubiq);
monkeyDoc.Save (monkeyDoc.FileUrl, UIDocumentSaveOperation.ForCreating, saveSuccess => {
Console.WriteLine ("Save completion:" + saveSuccess);
if (saveSuccess) {
monkeyDoc.Open (openSuccess => {
Console.WriteLine ("Open completion:" + openSuccess);
if (openSuccess) {
Console.WriteLine ("new document for iCloud");
Console.WriteLine (" == " + monkeyDoc.DocumentString);
viewController.DisplayDocument (monkeyDoc);
} else {
Console.WriteLine ("couldn't open");
}
});
} else {
Console.WriteLine ("couldn't save");
}


According to document ,when you save file to icloud,you need to use UIDocument .This will be Safe and stable.






share|improve this answer













Saving iCloud Documents



To add a UIDocument to iCloud you can call UIDocument.Save directly (for new documents only) or move an existing file using NSFileManager.DefaultManager.SetUbiquitious. The example code creates a new document directly in the ubiquity container with this code (there are two completion handlers here, one for the Save operation and another for the Open):



var docsFolder = Path.Combine (iCloudUrl.Path, "Documents"); // NOTE: Documents folder is user-accessible in Settings
var docPath = Path.Combine (docsFolder, MonkeyDocFilename);
var ubiq = new NSUrl (docPath, false);
var monkeyDoc = new MonkeyDocument (ubiq);
monkeyDoc.Save (monkeyDoc.FileUrl, UIDocumentSaveOperation.ForCreating, saveSuccess => {
Console.WriteLine ("Save completion:" + saveSuccess);
if (saveSuccess) {
monkeyDoc.Open (openSuccess => {
Console.WriteLine ("Open completion:" + openSuccess);
if (openSuccess) {
Console.WriteLine ("new document for iCloud");
Console.WriteLine (" == " + monkeyDoc.DocumentString);
viewController.DisplayDocument (monkeyDoc);
} else {
Console.WriteLine ("couldn't open");
}
});
} else {
Console.WriteLine ("couldn't save");
}


According to document ,when you save file to icloud,you need to use UIDocument .This will be Safe and stable.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 3 '18 at 2:12









Junior Jiang - MSFTJunior Jiang - MSFT

1,058128




1,058128













  • Thanks for reply. I had added your code and save the document using UIDocument as you said. file is saved inside the path Library --> Mobile Documents ({file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~company name~MobileA/Documents/SJA%20V001-2.pdf}) . But not visible in iCloud. Please help

    – amnk
    Dec 3 '18 at 5:29













  • is there anything to do to view iCloud syncrnozation file view in icloud?

    – amnk
    Dec 3 '18 at 5:37











  • Suggesting that you can try with saving a txt file like demo in document,and check it whether work.

    – Junior Jiang - MSFT
    Dec 4 '18 at 9:56











  • Yeh i Tried. its also going to this path.

    – amnk
    Dec 4 '18 at 11:12











  • Ok, also can not be saw in iCloud?Suggest that using NSMetadataQuery to get your icloud file list,it will show all file.

    – Junior Jiang - MSFT
    Dec 5 '18 at 1:16



















  • Thanks for reply. I had added your code and save the document using UIDocument as you said. file is saved inside the path Library --> Mobile Documents ({file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~company name~MobileA/Documents/SJA%20V001-2.pdf}) . But not visible in iCloud. Please help

    – amnk
    Dec 3 '18 at 5:29













  • is there anything to do to view iCloud syncrnozation file view in icloud?

    – amnk
    Dec 3 '18 at 5:37











  • Suggesting that you can try with saving a txt file like demo in document,and check it whether work.

    – Junior Jiang - MSFT
    Dec 4 '18 at 9:56











  • Yeh i Tried. its also going to this path.

    – amnk
    Dec 4 '18 at 11:12











  • Ok, also can not be saw in iCloud?Suggest that using NSMetadataQuery to get your icloud file list,it will show all file.

    – Junior Jiang - MSFT
    Dec 5 '18 at 1:16

















Thanks for reply. I had added your code and save the document using UIDocument as you said. file is saved inside the path Library --> Mobile Documents ({file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~company name~MobileA/Documents/SJA%20V001-2.pdf}) . But not visible in iCloud. Please help

– amnk
Dec 3 '18 at 5:29







Thanks for reply. I had added your code and save the document using UIDocument as you said. file is saved inside the path Library --> Mobile Documents ({file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~company name~MobileA/Documents/SJA%20V001-2.pdf}) . But not visible in iCloud. Please help

– amnk
Dec 3 '18 at 5:29















is there anything to do to view iCloud syncrnozation file view in icloud?

– amnk
Dec 3 '18 at 5:37





is there anything to do to view iCloud syncrnozation file view in icloud?

– amnk
Dec 3 '18 at 5:37













Suggesting that you can try with saving a txt file like demo in document,and check it whether work.

– Junior Jiang - MSFT
Dec 4 '18 at 9:56





Suggesting that you can try with saving a txt file like demo in document,and check it whether work.

– Junior Jiang - MSFT
Dec 4 '18 at 9:56













Yeh i Tried. its also going to this path.

– amnk
Dec 4 '18 at 11:12





Yeh i Tried. its also going to this path.

– amnk
Dec 4 '18 at 11:12













Ok, also can not be saw in iCloud?Suggest that using NSMetadataQuery to get your icloud file list,it will show all file.

– Junior Jiang - MSFT
Dec 5 '18 at 1:16





Ok, also can not be saw in iCloud?Suggest that using NSMetadataQuery to get your icloud file list,it will show all file.

– Junior Jiang - MSFT
Dec 5 '18 at 1:16




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53531009%2fxamarin-ios-cloud-file-copy-location-issue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks