• <legend id='04F6h'><style id='04F6h'><dir id='04F6h'><q id='04F6h'></q></dir></style></legend>

        <i id='04F6h'><tr id='04F6h'><dt id='04F6h'><q id='04F6h'><span id='04F6h'><b id='04F6h'><form id='04F6h'><ins id='04F6h'></ins><ul id='04F6h'></ul><sub id='04F6h'></sub></form><legend id='04F6h'></legend><bdo id='04F6h'><pre id='04F6h'><center id='04F6h'></center></pre></bdo></b><th id='04F6h'></th></span></q></dt></tr></i><div id='04F6h'><tfoot id='04F6h'></tfoot><dl id='04F6h'><fieldset id='04F6h'></fieldset></dl></div>

      1. <small id='04F6h'></small><noframes id='04F6h'>

          <bdo id='04F6h'></bdo><ul id='04F6h'></ul>
        <tfoot id='04F6h'></tfoot>

      2. 在 NSString 中解码 Base-64 编码的 PNG

        时间:2024-04-14

                  <tbody id='9YaPg'></tbody>

                  <bdo id='9YaPg'></bdo><ul id='9YaPg'></ul>

                  <small id='9YaPg'></small><noframes id='9YaPg'>

                  <legend id='9YaPg'><style id='9YaPg'><dir id='9YaPg'><q id='9YaPg'></q></dir></style></legend>
                • <tfoot id='9YaPg'></tfoot>
                • <i id='9YaPg'><tr id='9YaPg'><dt id='9YaPg'><q id='9YaPg'><span id='9YaPg'><b id='9YaPg'><form id='9YaPg'><ins id='9YaPg'></ins><ul id='9YaPg'></ul><sub id='9YaPg'></sub></form><legend id='9YaPg'></legend><bdo id='9YaPg'><pre id='9YaPg'><center id='9YaPg'></center></pre></bdo></b><th id='9YaPg'></th></span></q></dt></tr></i><div id='9YaPg'><tfoot id='9YaPg'></tfoot><dl id='9YaPg'><fieldset id='9YaPg'></fieldset></dl></div>
                • 本文介绍了在 NSString 中解码 Base-64 编码的 PNG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一些 NSData 是 Base-64 编码的,我想对其进行解码,我看到了一个看起来像这样的示例

                  I have some NSData which is Base-64 encoded and I would like to decode it, I have seen an example that looks like this

                  NSData* myPNGData = [xmlString dataUsingEncoding:NSUTF8StringEncoding];
                  
                  [Base64 initialize];
                  NSData *data = [Base64 decode:img];
                  cell.image.image = [UIImage imageWithData:myPNGData];
                  

                  然而,这给了我很多错误,我想知道如何才能让它工作.我需要将某种类型的文件导入到我的项目中还是必须包含框架?

                  However this gives me a load of errors, I would like to know what to do in order to get this to work. Is there some type of file I need to import into my project or do I have to include a framework?

                  这些是我得到的错误

                  Use of undeclared identifier 'Base64'
                  Use of undeclared identifier 'Base64'
                  Use of undeclared identifier 'cell'
                  

                  我到处找,不知道什么是正确的做法.

                  I have looked everywhere and cannot figure out what is the proper thing to do.

                  推荐答案

                  NSData Base64 库文件 会帮助你.

                  #import "NSData+Base64.h"
                  
                  //Data from your string is decoded & converted to UIImage
                  UIImage *image = [UIImage imageWithData:[NSData
                  dataFromBase64String:strData]];
                  

                  希望对你有帮助

                  Swift 3 版本

                  几乎一样

                  //Create your NSData object
                  let data = NSData(base64Encoded: "yourStringData", options: NSData.Base64DecodingOptions.ignoreUnknownCharacters)
                  
                  //And then just create a new image based on the data object
                  let image = UIImage(data: data as! Data)
                  

                  Swift 2.3 版本

                  //Create your NSData object
                  let data = NSData(base64EncodedString: "yourStringData", options: .IgnoreUnknownCharacters)
                  
                  //And then just create a new image based on the data object
                  let image = UIImage(data: data!)
                  

                  这篇关于在 NSString 中解码 Base-64 编码的 PNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 base64URL 解码为 base64 -- Swift 下一篇:如何将文件转换为 Base64?

                  相关文章

                  <i id='Dd7Fq'><tr id='Dd7Fq'><dt id='Dd7Fq'><q id='Dd7Fq'><span id='Dd7Fq'><b id='Dd7Fq'><form id='Dd7Fq'><ins id='Dd7Fq'></ins><ul id='Dd7Fq'></ul><sub id='Dd7Fq'></sub></form><legend id='Dd7Fq'></legend><bdo id='Dd7Fq'><pre id='Dd7Fq'><center id='Dd7Fq'></center></pre></bdo></b><th id='Dd7Fq'></th></span></q></dt></tr></i><div id='Dd7Fq'><tfoot id='Dd7Fq'></tfoot><dl id='Dd7Fq'><fieldset id='Dd7Fq'></fieldset></dl></div>
                • <small id='Dd7Fq'></small><noframes id='Dd7Fq'>

                • <tfoot id='Dd7Fq'></tfoot>

                  <legend id='Dd7Fq'><style id='Dd7Fq'><dir id='Dd7Fq'><q id='Dd7Fq'></q></dir></style></legend>
                  • <bdo id='Dd7Fq'></bdo><ul id='Dd7Fq'></ul>