URLForUbiquityContainerIdentifier:网络访问不可用时返回nil吗?

编程入门 行业动态 更新时间:2024-10-27 14:20:11
本文介绍了URLForUbiquityContainerIdentifier:网络访问不可用时返回nil吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当处于飞行模式或网络访问不可用的任何其他状态时,将调用NSFileManager的 URLForUbiquityContainerIdentifier:返回nil?

When in airplane mode or any other state where network access is not available, will a call to NSFileManager's URLForUbiquityContainerIdentifier: return nil?

对此的跟进问题是:如果此次调用 URLForUbiquityContainerIdentifier:不返回nil而是返回网络访问不可用时的有效URL是否可以离线访问基于云的文档?

A follow up question to this is: if this call to URLForUbiquityContainerIdentifier: DOES not return nil but rather returns a valid URL when network access is not available is this a way to access cloud based documents offline?

苹果文档声明如果iCloud将返回nil未配置或未启用。它没有提到如果没有网络访问会发生什么。

The apple docs state that this will return nil if iCloud is not configured or not enabled. It does not mention what will happen if network access is not available.

我会自己测试一下,但据我所知,我必须在实际设备上进行测试目前我无法在设备上进行测试。谢谢!

I would test this myself but from what I understand I would have to test this on an actual device and testing on a device is not possible for me at this time. Thank you!

推荐答案

UbiquityContainer是一个本地存储容器,包含您从iCloud请求的文档。当网络没有时,此容器可用。通过使用以下示例

The UbiquityContainer is a local storage container that contains the documents you requested from iCloud. This container is available when when the network is not. By using the following example

NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; if (ubiq) { NSLog(@"iCloud access at %@", ubiq); // TODO: Load document... } else { NSLog(@"No iCloud access"); }

手机均匀时,您将可以访问文件和普遍存储容器在飞机模式。当网络连接恢复时,icloud守护程序将自动同步文件,即使在后台也是如此。

You will be able to access the files and ubiquity container when the phone is even in airplane mode. When the network connections restore the icloud daemon will automatically sync the files even in the background.

这是一篇关于iCloud设置的精彩文章。 www.raywenderlich/6015/开始-icoloud-in-ios-5-tutorial-part-1

Here is a great article on iCloud setup. www.raywenderlich/6015/beginning-icloud-in-ios-5-tutorial-part-1

更多推荐

URLForUbiquityContainerIdentifier:网络访问不可用时返回nil吗?

本文发布于:2023-11-12 19:26:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582321.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:网络   URLForUbiquityContainerIdentifier   nil

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!