English 中文(简体)
i ±:我可以忽略不计失职的人吗?
原标题:iCloud: can I ignore those who disable iCloud?

I m在争取一个比喻,并贴出一个更一般性的问题:here。 我的最大问题是,我是否应当停止将用户数据放在在沙箱中发现的老旧文件夹中。 说明我的问题:

“enterography

The docs don t give an answer as far as I can see. Let s suppose I have an App which handles different txt files. Once I start my app, I simply check if any txt files are in the cloud like so:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSLog(@"AppDelegate: app did finish launching");
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];

    // (1) iCloud: init

    NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
    if (ubiq) {
        NSLog(@"User has iCloud enabled! Let s get the txt files from the cloud.");
        [self loadDocument];
    } else {
        NSLog(@"User doesn t have iCloud enabled. App is thus worthless.");
    }


    return YES;
}

然后,我有办法检查云层是否有任何轴心档案,如果是,则装上。 否则,我就在云层中制造新的x。

这意味着,该信没有在文件夹中储存任何数据。 根据我的理解,所有东西都存在于我的装置(如果用户为FLINE)的当地i ±贮存或云层。 因此,文本档案存在于两个地方:我的装置和云层。

www.un.org/Depts/DGACM/index_spanish.htm 因此,我无需在当地文件夹中储存第三份副本? 或者,出于某种原因,我忽略了这一点吗? 换言之,如果我向我的用户提供i ——那么我应当使用当地文件夹? (我可以简单地忽视那些赢得一等签字的人吗?)


EDIT:我只想澄清一下,当我谈论的是沙箱中的标准文件时,我指的是:

NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
最佳回答

没有理由在当地储存和在i±储存文件。 然而,你们应当让用户选择将i±储存倒闭。 在“i<0>外”储存后,你只能在当地储存档案(如“iOS5”前注)。 最好的做法是试图孤立你们的法典中需要知道文件存放地点的部分,并检验文件是否可提供并能够提供,并使法典的一部分能够归还应当存放文件的URL。

Update: If you want to diverge for iOS5 vs. iOS4, you just need to test if the iOS5 features are there. There are several ways that you can do this. One way is to check:

if ([IDDocument category] = nil)

就Si4而言,情况是真实的,就SOS5而言,这将是虚假的。 我不知道你对你的档案有何类型的数据结构,但你可以做的一件事是围绕“国际调查文件”制作一个包裹。 在这种包装类别中,你可以有假装文件结构的变量,以及你在IOS4(如进入档案的道路)需要的领域。 当你上下班时,检验i±是否允许,如果能够提供国际不动产业联合会文件,如果是,如何使用这种文件并确定领域。 否则,将其他领域划为零,使国际不动产业证书领域成为零。 当你需要根据你的“档案”进行操作时,如果“IDDocument”领域没有,如果是“旧”方式的话。 否则,只是根据要求才向国际不动产业联合会提出反对。

问题回答

也许我很慢,在第四或第五时间重新阅读了该笔书,我来此说,你应该总是在沙箱中制造你的文件,然后将这些档案带上云层。 因此, Apple果建议,在任何时候都有三种版本的同一档案:

Apps use the same technologies to manage files and directories in iCloud that they do for local files and directories. Files and directories in iCloud are still just files and directories. You can open them, create them, move them, copy them, read and write from them, delete them, or any of the other operations you might want to do. The only differences between local files and directories and iCloud files and directories is the URL you use to access them. Instead of URLs being relative to your app’s sandbox, URLs for iCloud files and directories are relative to the corresponding iCloud container directory.

将档案或目录移至i±:

Create the file or directory locally in your app sandbox. While in use, the file or directory must be managed by a file presenter, such as a UIDocument object.

Use the URLForUbiquityContainerIdentifier: method to retrieve a URL for the iCloud container directory in which you want to store the item. Use the container directory URL to build a new URL that specifies the item’s location in iCloud. Call the setUbiquitous:itemAtURL:destinationURL:error: method of NSFileManager to move the item to iCloud. Never call this method from your app’s main thread; doing so could block your main thread for an extended period of time or cause a deadlock with one of your app’s own file presenters. When you move a file or directory to iCloud, the system copies that item out of your app sandbox and into a private local directory so that it can be monitored by the iCloud daemon. Even though the file is no longer in your sandbox, your app still has full access to it. Although a copy of the file remains local to the current device, the file is also sent to iCloud so that it can be distributed to other devices. The iCloud daemon handles all of the work of making sure that the local copies are the same. So from the perspective of your app, the file just is in iCloud.

All changes you make to a file or directory in iCloud must be made using a file coordinator object. These changes include moving, deleting, copying, or renaming the item. The file coordinator ensures that the iCloud daemon does not change the file or directory at the same time and ensures that other interested parties are notified of the changes you make.

rel=“nofollow> 见上文

请注意,如果用户能够把装置备份到i±,则文件目录就得到任何途径的支持。

这真的取决于您是否计划将i±作为 app/平台之间的辛迪加工具。 如果你不这样做,那么使用i ± 储存你的文件确实毫无意义。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签