Reputation: 12051
Working on a test iOS
app I have faced the following problem.
From a remote webserver I recieve a .p7s
file with the following contents (which are viewable in Mac's TextEdit
app):
0Ä *ÜHܘ
†Ä0Ä10 +�0Ä *ÜHܘ
†Ä$ÄÇ˚<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CHALLENGE</key>
<string>panacya</string>
<key>IMEI</key>
<string>01 232700 828513 5</string>
<key>PRODUCT</key>
<string>iPad1,1</string>
<key>SERIAL</key>
<string>GB0269NJETU</string>
<key>UDID</key>
<string>2866681d94ae6c56d189485d39c54eaedecf211c</string>
<key>VERSION</key>
<string>9A5288d</string>
</dict>
</plist>
������†Ç
[0ÇÛ0Ç\†
u6ÜΩ~60
*ÜHܘ
�0Z10 UUS10U
Apple Inc.10UApple iPhone10UApple iPhone Device CA0
110808222517Z
140808222517Z0ÅÉ1-0+U$2890C19C-43F9-47C5-8534-A54F184E37DC10 UUS10 UCA10U Cupertino10U
Here's the link to the original file - https://www.dropbox.com/s/lm05gg866zdrz20/ota-response.p7s?dl=0
I then save the NSData
as a .p7s
file to disk.
I need to get the embedded .plist
out of the file (judging from what I see it contains exactly that) or at least convert it to readable NSString
which I can then display in UILabel
.
Is it at all possible and how do I achieve it?
Upvotes: 0
Views: 754
Reputation: 112857
You can read it into an NSData
instnace and use
- (NSRange)rangeOfData:(NSData *)dataToFind options:(NSDataSearchOptions)mask range:(NSRange)searchRange
to find the beginning and end of the plist. Then use
- (NSData *)subdataWithRange:(NSRange)range
to optain just the plist data. Finally convert to a NSString
with:
- (instancetype)initWithData:(NSData *)data encoding:(NSStringEncoding)encoding
Upvotes: 1