iOS base64 issue -
the base64 string
av/u+hkoahxhdycrntxxyigtdzedmoc6zt+fu7kqpylayb8cxwrgjblwvna7iyyah50lv87ebhe9pqsxjz/3a07c9yc251jaglfoe/2s0kihllmuse8q+lf/ezro2iq9wo6vmtd+itkp421cbqlull0fzur5lwqmqw2x/oyzhi3/9ho4jqfd8ge022p0ottwgvepqmtlwjus4nqlym+i9ohxz41kqgc0rtf9gs7srihugvk8o8xnciemuomnmxflqdcpgswmzpkwhxs79yjujyphc409/iktk6mwmzc/omtytxeguqpdoeenwf8f7inxbolpydbdhd7zlv/mc+skspfc0mnpdlyul0e3ztloquolmjugct3z1apdo4dlbqny7hlnusb01o/dmumnrakpsth/jsbbctit8jggjkpt8ab7/oo6cnohdtdy1t7yxqo0zlxulrbymhl0sj9cng3mq/eaalvdhxezs9agkudo4gjmhdkff+if3i2/yfegydcyakvjfuasam5s7qjlrbkhjtqydrwwqbk+15ejxhfufdcgm64xngvsrko1luj7tcnlvk330wclicylz25jfmdujqpagdenbkdht7w3inebv+g0jpgh4vz2jnlv5vjto5ml5z7mgkooo2npmqmsobvkiq==
and using
nsdata *plaindata = [plainstring datausingencoding:nsutf8stringencoding]; nsstring *base64string = [plaindata base64encodedstringwithoptions:0]; nslog(@"%@", base64string);
to decode base64 sting result base64sting null. there wrong base64 sting?
thank in advance.
try this:
nsdata *decodeddata = [[nsdata alloc] initwithbase64encodedstring:base64string options:0]; nsstring *decodedstring = [[nsstring alloc] initwithdata:decodeddata encoding:nsutf8stringencoding];
hope helps.. :)
Comments
Post a Comment