Wayne
Wayne

Reputation: 363

Accessing file within Safari extension from app

I'm building safari content blocker (xcode 7 beta 4).

In app I use SFContentBlockerManager.reloadContentBlockerWithIdentifier to actualize blockerList.json file, but I can't access it to rewrite with new rules.

let dir = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, [.AllDomainsMask], true).first!
let file = NSURL.fileURLWithPath(dir.stringByAppendingPathComponent("blockerList.json"))
try String(contentsOfURL: file, encoding: NSUTF8StringEncoding)

throws exception, about file not found.

Also it seems that beginRequestWithExtensionContext still not called (no breakpoint or NSLog worked). So - I also can't load updated json file through extension code.

Upvotes: 1

Views: 196

Answers (0)

Related Questions