Last active
January 4, 2016 03:18
-
-
Save clowwindy/0d800f07a5e95e5c4dd0 to your computer and use it in GitHub Desktop.
stringByAddingPercentEncodingWithAllowedCharacters Crash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main(int argc, char * argv[]) { | |
@autoreleasepool { | |
NSString *s1 = @"对于Launcher这类产品来说,它很容易让人们陷入这是工具还是平台的争执中。不过在李涛看来,这种争执完全是一个伪命题,因为一款产品用的人多了它自然就是平台,用的人少了它什么都不是。基于此,李涛其实并没有过多的去考虑APUS Launcher要做平台还是工具,他想的更多的是如何解决用户的问题。作为一个即用iOS又用Android的用户,我本人的一个体会就是iPhone会给人一种你越用越觉得它好用的感觉,但Android就不会。所以APUS Launcher现在就要解决这个难题,让Android变得好用。这也是为何李涛会说自己做的不是一个Launcher而是一套“用户系统”。"; | |
NSString *s2 = [s1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
// crash with iOS 8.1 SDK! | |
NSString *s3 = [s1 stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]; | |
NSLog(@"%@", s2); | |
NSLog(@"%@", s3); | |
return 0; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test: main.m | |
gcc -o main main.m -framework Foundation |
I have no idea how to use stringByAddingPercentEncodingWithAllowedCharacters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have no idea about what does
@
symbol stand for.