     let dir = library.URLByAppendingPathComponent(folder)
     let contents = try manager.contentsOfDirectoryAtPath(dir.path!)
     for content in contents {
-        try manager.removeItemAtURL(dir.URLByAppendingPathComponent(content))
+        do {
+            try manager.removeItemAtURL(dir.URLByAppendingPathComponent(content))
+        } catch where ((error as NSError).userInfo[NSUnderlyingErrorKey] as? NSError)?.code == Int(EPERM) {
+            // "Not permitted". We ignore this.
+            log.debug("Couldn't delete some library contents.")
+        }
     }
 }
 

                    storage.removeCredential(credential, forProtectionSpace: space)
                }
            }
            return succeed()
        }
    }

            SDImageCache.sharedImageCache().clearDisk()
            SDImageCache.sharedImageCache().clearMemory()
            NSNotificationCenter.defaultCenter().postNotificationName(NotificationPrivateDataClearedHistory, object: nil)
            log.debug("HistoryClearable succeeded: \(success).")
            return Deferred(value: success)
        }
    }
