Expanding a little on suggestions above, if you just want to grab the HTML, the following code snippet may be a good starting point. By inspecting the webMainResource dictionary you can extract other material too, such as images.
#define WEB_ARCHIVE @"Apple Web Archive pasteboard type"
- (NSString*) htmlStringFromPasteboard;
{
NSData* archiveData = [[UIPasteboard generalPasteboard] valueForPasteboardType:WEB_ARCHIVE];
if (archiveData)
{
NSError* error = nil;
id webArchive = [NSPropertyListSerialization propertyListWithData:archiveData options:NSPropertyListImmutable format:NULL error:&error];
if (error)
{
return [NSString stringWithFormat:@"Error: '%@'", [error localizedDescription]];
}
NSDictionary* webMainResource = [webArchive objectForKey:@"WebMainResource"];
NSData * webResourceData = [webMainResource objectForKey:@"WebResourceData"];
NSString* string = [[NSString alloc] initWithData:webResourceData encoding:NSUTF8StringEncoding];
return [string autorelease];
}
return @"No WebArchive data on the pasteboard just now";
}