Sharing a mkmapview screenshot

大憨熊 提交于 2019-12-23 20:02:02

问题


I have a map with lots of stuff on it, which I'd like to share in form of a picture/screenshot.

However, as far as i know, the map --both iOS 6 for Apple and iOS 5 for Google-- is copyrighted and I can't simply do that. I thought of Google Static Maps API, but I didn't find something similar for the Apple maps to be available. How could I share a mapview picture without violating their rules and still using the MapKit framework ?

Thanks!


回答1:


I'm struggling myself with laws of sharing Apple map snapshot with track information on it. Sent an enquiry to Apple technical support, got redirected to App Review team, got only an answer with guidelines links so far. Read the license info from tapping on "Legal" link and yes all rights are "reserved". Sent a request to Tom Tom asking if they would feel bad about such personal sharing.

Situation is rather sad for Apple if we can't as I'd have to resort to OSM map soon for showing tracks and Apple map use cases in my app (and I guess many others) come to zero.

For the answer, I'm thinking about leaving only one option for saving the map/track snapshot: "Save to camera roll". If user can take a screenshot at any moment, I can just prepare the "better" image with no toolbars etc, and then users can do with image in the camera roll whatever they need to do? I only provide the image they could have cropped themselves? I don't need to care if and how do they share?

So it is just a suggestion to run through and see if it sounds reasonable...




回答2:


How exactly would you like to share it?
If by email, then you can send the map embedded in the email body, so it is even interactive.




回答3:


- (UIImage *) imageFromView:(UIView *)view {

    UIGraphicsBeginImageContext(view.frame.size);
    CGContextRef currentContext = UIGraphicsGetCurrentContext();
    CGContextTranslateCTM(currentContext, 0, view.size.height);
    // passing negative values to flip the image
    CGContextScaleCTM(currentContext, 1.0, -1.0);
    [[appDelegate.scatterPlotView layer] renderInContext:currentContext];
    UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return screenshot;
}

Just add your mapview To uiview and the pas uiview to this method and now you can share your mapview image to anywhere.



来源:https://stackoverflow.com/questions/17786170/sharing-a-mkmapview-screenshot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!