Panda Pig • Patty original or translated works. Welcome reprint, Reprint please indicate the source.
Assuming that the writing is not good please give more advice, assuming that it is good please support a lot of praise. Thank you! Hopy;)
How to use icloud in your own app has a lot of articles to look at, here is the cat encountered some of the problems highlighted, hoping to help the first contact of children's shoes.
1. Invalid resolution using Teamid
Some articles point to the ability to pass a combined container ID when invoking Nsfilemanager's instance method Urlforubiquitycontaineridentifier: can also pass nil. Assuming that passing nil means getting the URL of the first container in icloud (assuming you have multiple containers).
Assuming that you pass an actual container ID, Apple wants you to generate that ID in a combination of Teamid.bundleid (which is stated in a book). But actually, the container URL returned with this method is always nil, Teamid is obtained from the developer ID descriptive narrative page in the developer site.
However, assuming that nil is passed as described above, the container URL can be obtained.
This opens the. entitlements file that Xcode generates for you to see that the teamid is not so-called teamid, but simply the string "ICloud":
So we changed the Teamid to icloud in the code, and I tried to change the prefix directly in Xcode's capabilities:
However, the compile-time prompts an error, presumably meaning that the icloud prefix must start with icloud.
But I do not rule out that there are other ways to change the prefix.
2. How to see the actual file name in icloud on your iOS device
As you know, on iOS devices, for example, the iphone's icloud settings can see every app that uses icloud, and we can see the files that the app saves in icloud.
But some children's shoes may find themselves writing apps that don't see the corresponding file names in icloud, but simply show a general size:
So how do you get it to display a specific file?
In fact, very easy, just put your directory or files in the icloud container root directory under the documents directory can be.
As you can see, I have created the MyString.txt file and tools directory in the documents directory.
Some things to note about using icloud in iOS (Xcode7.2)