我正在尝试使用路径字符串构建 NSURL。该字符串看起来不错,但是当我尝试将其放入 NSURL 时,它会得到一堆乱码。这是我用来构建 url 的代码:
NSString* path = [[AppSettings instance].contentRootPath stringByAppendingPathComponent: item.fileName];
NSLog(path);
item.contentPath = [NSURL URLWithString:[path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSLog(item.contentPath.absoluteString);
这是日志:
2012-07-25 10:28:39.983 mxHub[44036:207] /Users/casey.borders/Library/Application Support/iPhone Simulator/5.0/Applications/C2C1975D-7FAB-4E6C-A091-DC389223CC57/Documents/.content/ Prezista-PI.pdf
2012-07-25 10:28:41.654 mxHub[44036:207] /Users/casey.borders/Library/Application扡潳畲整瑓楲杮䄀䅖獳瑥慃档e獡敳䍴捡敨楗桴剕㩌猀稳佥䕦瑮祲潆䭲:ㅱ䀲㨰䀴祥卸敲潭敶湅牴䙹牯敋㩹挀敲敲瑮枫驱猀瑥愠愠䕸瑮祲枫驱:慭䕸瑮祲稳枫驱猀瑥愠㩥洀桡枫驱䀀䄢䅖獳瑥慱档䥥瑮牥虑≬䄀䅖獳瑥慃档䥥瑮牥虑l湩楗桴楄獩楗桴楄獯虑祲:慤驱獕湩䕧据挚湩㩧污潬䍷獯祳潃瘾牥楳汤:惯䉮䍥汤敶玱摥洁湅潣楤莹杮:湩楗桴岸防攺据挚湩㩧攀瑸湥敤䱤杯栗防瑓楲杮湅潣椤杮攀瑸湥敤䱤杯栗惊䄀偖慬敹䥲整䅭捣獥䱳杯开捡散獳潌䅧牲祡攀敶瑮的灟慬敹䥲整䅭捣獥䱳杯䀀䄢偖慬敹䥲杯整䅭捣獥义《整湲污》恶祡牥瑉浥捁散獳潌䥧瑮牥虑l潬䅧灯数祡䄀偖慬敹䥲整䅭捣獥䱳杯癅湥t畮捻牥晏牡墙噤摩潥浡墙卥碗敢浮捩瑡瑕摕楬牴牴瑡e扯摕摕極牴牴瑡瑡慲牥晴晴整扬慲狝敦味摥測慲狝敦味摥測極牴牴瑡摕摕楬極獴敨泷湷潬湥獴敨湷潬湥獴扴湴潬摡摥畄慲楴汤瀀慬批捡卫防玱晏獦獦瑥瀀慬批捡卫獥楳汤䑉渀浵敢佲贾牥敶䅲摤敲獥敶䅲摤敲獳桃湡敧s敳牥摁牤獥剕我祡正慢獥剕我瑓牡摴瑡e畮扭牥晏敓浧湥獴摴湷潬摡摥开祡牥瑉浥捁散獳潌䕧敶瑮䀀䄢偖慬敹䥲整䅬獥䱳杯捣癒湥䥀瑮牥␥␥␥恶祡牥瑉浥捁散獳潌䕧敶瑮湉整湲污搀捩t┊@恶祡牥瑉浥牅潲䱲杯牥潲䱲杯牁慲y灟慬敹䥲整䕭牲牯潌开≀恶祡祡瑉浥牅潲䱲杯湉整湲污”恶祡牥瑉浥牅潲䱲杯湉整湲污䄀偖慬敹䥲整䕭牲牯潌䕧敶瑑攀牲牯潃浭湥t牉潲䑲浯楡n牲潲卲惊吓䍳挚灟慬敹䥲整䕭牲潌䕧敶瑮䀀䄢偖慬敹䥲整䕭牲牯潌䕧敶瑮湉整湲污;瑉浥牅潲䱲杯癅湥䥴瑮牥虑l碗剳捥牯楤杮攀牲牯楗桴漱慭湩挺杯挚㩥猎牥湉潦:潶捩䍥汤牴汯敬䕲摮汐祡正慢湉整牲灵楴汤:潶捩䍥汤牴汯敬䕲摮敒潣摲湉整牲灵楴汤:潶捩䍥汤牴毯敬偲慬捡批䉫晵敦䅲庆汩扡敬戺晵庆敦汩扡楯散潃瑮潲汱牥楄Ǭ卤玱祡湩㩧捣獥可畜畬畬:支持/iPhone 〪ᶀЀꀠ/Āࠀ쵠imulator/5。0/应用程序/C2C1975D-7FAB-4E6C-A091-DC389223CC57/Documents/.content/Demo.pdf