8

My code:

NSFileManager.defaultManager().removeItemAtPath(path, error: nil)

My log error:

NSUnderlyingError=0x618000255900 "The operation couldn’t be completed. Permission denied"})
“SecureDelete Lite” couldn’t be removed because you don’t have permission to access it

I have read two topics but they don't resolve my bug.

osx - How to programmatically delete a file with elevated privileges?

Obtaining admin privileges to delete files using rm from a Cocoa app

Answers with Objective-C or Swift are OK.

Community
  • 1
  • 1
Huynh Inc
  • 2,010
  • 1
  • 25
  • 42
  • Thanks @nhgrif, this is my solution: http://stackoverflow.com/questions/6267197/osx-how-to-programmatically-delete-a-file-with-elevated-privileges – Huynh Inc Apr 02 '15 at 02:13
  • How was the file that you are trying to delete created? It looks like you are trying to delete your own app? – Paulw11 Apr 02 '15 at 04:52
  • 2
    Your question is tagged with `iOS` and `Cocoa Touch`, but linked questions are for OS X. – Tricertops Apr 21 '15 at 11:43

0 Answers0