Posts

Post not yet marked as solved
5 Replies
4.2k Views
I want to filter users browsing activity based on response content.I started by implementing a simple NEFIlterDataProvider extension based on docs and official iOS-samplesAfter that, I tried everything I could find here and in SO threads, but I can't make breakpoints or output work.https://forums.developer.apple.com/thread/11241https://forums.developer.apple.com/thread/9775I have tried all the debugging methods mentioned in the topics above, but I don't see any triggered breakpoints or any output in the device consoleHere is the simplest extension code, but I can’t debug it anywayimport NetworkExtension import os.log class FilterDataProvider: NEFilterDataProvider { override func startFilter(completionHandler: @escaping (Error?) -> Void) { // Add code to initialize the filter. os_log("---------------------FOR LOGGING----------------------") completionHandler(nil) } override func stopFilter(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) { // Add code to clean up filter resources. os_log("---------------------FOR LOGGING----------------------") completionHandler() } override func handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict { print("new flow: \(flow)") os_log("---------------------FOR LOGGING----------------------") // Add code to determine if the flow should be dropped or not, downloading new rules if required. return .drop() } }Even with .drop() response handling I still can browse freely so looks like it doesn’t work for me.Here are my entitlements and a part of info.plist.<dict> <key>com.apple.developer.networking.networkextension</key> <array> <string>app-proxy-provider</string> <string>content-filter-provider</string> <string>packet-tunnel-provider</string> </array> <key>com.apple.security.application-groups</key> <array> <string>group.ArunBuduri.urlFetcher</string> </array></dict></plist>Info.plist<key>NSExtension</key><dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.networkextension.filter-data</string> <key>NSExtensionPrincipalClass</key> <string>FilterDataProvider</string></dict>When I try to connect XCode to a running extension, I always have "waiting to attach to "extension name' on device" message.I have a supervised device but I didn't do any additional profile customization or something like that.I'm working with 10.2.1 XCode, but I tried to debug it on different versions including 8x.My host app is just a VC with a link to a site to test the extension. I tried to connect extension to my host application and browsers, filter extension is added to the Embed Binaries, and I have no idea what I'm doing wrong. Maybe I need to extend my host application functionality or do some work with my device's profile to enable content filter?I will be glad to any comment or advice, thanks.
Posted
by Altenaar.
Last updated
.