Sandboxing and reading folderitems from prefs

  1. 3 months ago

    Beatrix W

    Jun 10 Pre-Release Testers, Third Party Store Europe (Germany)

    After my recent adventures with saving and restoring folders in Catalina in https://forum.xojo.com/54254-wwdc-gotchas-for-xojo-developers something occurred to me: in the Sandboxed version of my application I still use my standard code for saving and restoring folderitems. Here is the restoring code:

    Dim theCFObject As CFObjectMBS = theCFPrefs.CopyAppValue(NewCFStringMBS(fieldName), theCFPrefs.kCFPreferencesCurrentApplication)
    if theCFObject = Nil then Return nil
    
    dim theFolderitem as FolderItem
    if theCFObject.TypeDescription = "CFString" then
      dim FieldValue as String = CFStringMBS(theCFObject).str
      
      theFolderitem = Volume(0)
      dim theSaveInfo as String = DecodeBase64MBS(FieldValue)
      return theFolderitem.getRelative(theSaveInfo)
    end if

    I double-checked that this works fine when the app is Sandboxed. Is this something that should work? Will this continue to work in the AppStore? Should I change this to using security scoped bookmarks?

    @Beatrix W I double-checked that this works fine when the app is Sandboxed. Is this something that should work? Will this continue to work in the AppStore? Should I change this to using security scoped bookmarks?

    AFAIK: It shouldn't work at all!

    While Security-Scoped Bodgemarks are the most appropriate replacement; please consider the alternative suggestions first, and make sure that you're fully aware of the pitfalls of when they fail.

  2. Sam R

    Jun 10 Pre-Release Testers, Xojo Pro, Third Party Store Answer Hengchun, Pingtung, Taiwan

    @Beatrix W I double-checked that this works fine when the app is Sandboxed. Is this something that should work? Will this continue to work in the AppStore? Should I change this to using security scoped bookmarks?

    AFAIK: It shouldn't work at all!

    While Security-Scoped Bodgemarks are the most appropriate replacement; please consider the alternative suggestions first, and make sure that you're fully aware of the pitfalls of when they fail.

  3. Beatrix W

    Jun 10 Pre-Release Testers, Third Party Store Europe (Germany)

    That's totally odd because accessing the files worked fine without the security bookmarks. When they fail my app doesn't work because the main file can't be opened. But the main file can't move in the Sandbox version.

or Sign Up to reply!