【问题标题】:Observe NSURL iCloud Property观察 NSURL iCloud 属性
【发布时间】:2012-04-20 04:17:48
【问题描述】:

有没有办法观察像 NSURLUbiquitousItemPercentDownloadedKey 这样的 NSURL iCloud 属性的变化?

【问题讨论】:

    标签: iphone ios ipad ios5 icloud


    【解决方案1】:

    NSURL 中查询NSURLUbiquitousItemPercentDownloadedKey 不起作用。您应该改用NSMetadataQueryNSMetadataUbiquitousItemPercentDownloadedKey

    【讨论】:

      【解决方案2】:

      您应该注册这样的通知:

          [[NSNotificationCenter defaultCenter]
           addObserver: self
           selector: @selector (iCloudAccountAvailabilityChanged:)
           name: NSUbiquityIdentityDidChangeNotification
           object: nil];
      

      iCloudAccountAvailabilityChanged 会在 iCloud 状态改变时被调用。在这个地方,您还可以重新查询您的 ubiquity 容器的 URL。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-06-05
        • 2021-03-30
        • 1970-01-01
        • 2017-04-25
        • 1970-01-01
        • 1970-01-01
        • 2017-11-29
        • 2011-05-27
        相关资源
        最近更新 更多