I entered a URL that triggers my handler, but I get this from the Xcode debug log:
> 2014-10-20 07:42:08.968 MyApp[94134:303] *** Assertion failure in -[NSWindow > setTitle:], /SourceCache/AppKit/AppKit-1265.21/AppKit.subproj/NSWindow.m:2901 > 2014-10-20 07:42:08.972 MyApp[94134:303] *** WebKit discarded an uncaught > exception in the webView:didFinishLoadForFrame: delegate: > <NSInternalInconsistencyException> Invalid parameter not satisfying: aString > != nil Here’s my -startLoading method. I tried “about:”, which is the only URL I handle directly in the method. > - (void)startLoading { > NSAssert([self.class canInitWithRequest:self.request], @"Inappropriate > request."); > NSAssert(!self.processing, @"Receiving new protocol request while > processing another."); > > // Handle the blank "about:" URL. > NSString * const path = self.request.URL.path; > NSString * const query = self.request.URL.query; > > if (!path || [path isEqualToString:@""]) { > if (query) goto error; > NSStringEncoding const encoding = NSUTF8StringEncoding; > NSData * const aboutData = > [@"<html><head><title>about</title></head><body>about:</body></html>" > dataUsingEncoding:encoding]; > > [self.client URLProtocol:self didReceiveResponse:[[NSURLResponse > alloc] initWithURL:self.request.URL MIMEType:@"text/html" > expectedContentLength:aboutData.length > textEncodingName:nil/*(__bridge_transfer NSString > *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(encoding))*/] > cacheStoragePolicy:NSURLCacheStorageNotAllowed]; > [self.client URLProtocol:self didLoadData:aboutData]; > [self.client URLProtocolDidFinishLoading:self]; > } else { > NSString * const handler = AboutKeyToSelectorMap()[path]; > > if (handler) { > self.processing = [NSThread currentThread]; > self.cancelled = NO; > [self performSelector:NSSelectorFromString(handler) > withObject:query afterDelay:0.0 inModes:@[[NSRunLoop > currentRunLoop].currentMode, NSDefaultRunLoopMode]]; > } else { > goto error; > } > } > return; > > error: > // Bad response. > [self.client URLProtocol:self didFailWithError:[NSError > errorWithDomain:NSURLErrorDomain code:NSURLErrorResourceUnavailable > userInfo:nil]]; > } I thought using “nil” instead of the big expression calculating the encoding string would make a difference. It didn’t. — Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com