iOS Make sure documents are open before accessing

后端 未结 2 1880
天命终不由人
天命终不由人 2021-01-28 17:19

When opening UIDocuments from a closed state, I understand that it is it done on another thread. My question is, if I have code on my main thread that will access the document (

2条回答
  •  旧时难觅i
    2021-01-28 17:42

    You should use documentState property of UIDocument class. For more detail refer this document documentState description.

    It returns following enumerators to check:

    enum {
        UIDocumentStateNormal          = 0,
        UIDocumentStateClosed          = 1 << 0,
        UIDocumentStateInConflict      = 1 << 1,
        UIDocumentStateSavingError     = 1 << 2,
        UIDocumentStateEditingDisabled = 1 << 3   }; typedef NSInteger UIDocumentState;
    

    From Description: UIDocumentStateNormal is what you want, as:
    The document is open, editing is enabled, and there are no conflicts or errors associated with it.

提交回复
热议问题