mardi 20 janvier 2015

NSURL bookmarkDataWithOptions not working as expected [on hold]


I am new to Swift & Mac. In our App, trying to save bookmarks of User selected URL using NSURL bookmarkDataWithOptions with “includingResourceValuesForKeys” which seems to successfully create a bookmark data BUT without ANY KEYS as seen in the EMPTY dictionary when retrieving using NSURL.resourceValuesForKeys. The entitlements are also enabled as suggested in this Sandboxed App. The code is below:



let bookmarkURLData = url.bookmarkDataWithOptions(NSURLBookmarkCreationOptions.WithSecurityScope, includingResourceValuesForKeys: ["filePathURL"], relativeToURL: nil, error: nil)
let securityScopedUrl = NSURL.resourceValuesForKeys(["filePathURL"], fromBookmarkData: bookmarkURLData!)
println(securityScopedUrl) // shows empty dict, [:]


Can someone please help with where is the problem?





Aucun commentaire:

Enregistrer un commentaire