9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[備忘録]コピペしてすぐ使える NSDataをNSURLに変換

Last updated at Posted at 2015-04-22

需要が少ないのか、検索しても有用な情報が出てこなかったので、備忘録。

sample1.m
        NSData * originalData = [self getNsdataFromDokoka];
        
        NSString * dataFormatString = @"data:application/octet-stream;base64,%@";
        NSString * base64Data = [originalData base64EncodedStringWithOptions:0];
        
        NSString * dataString = [NSString stringWithFormat:dataFormatString, base64Data];
        
        NSURL *url = [NSURL URLWithString:dataString];

data:application/octet-stream;base64 は、Data URI scheme。
http://ja.wikipedia.org/wiki/Data_URI_scheme

application/octet-stream←この辺りは、以下を参考に。
http://ja.wikipedia.org/wiki/Multipurpose_Internet_Mail_Extensions#Content-Type

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?