safe base64

 NSString * success = [NSString stringWithFormat:@"%@%@",BASE_URL,CALLBACKSUCCESS];

        NSData* successOriginalData = [successdataUsingEncoding:NSUTF8StringEncoding];

        NSString * successBase64String = [successOriginalData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];

        successBase64String = [successBase64StringstringByReplacingOccurrencesOfString:@"/"withString:@"_"];

        successBase64String = [successBase64StringstringByReplacingOccurrencesOfString:@"+"withString:@"-"];

        successBase64String = [successBase64StringstringByReplacingOccurrencesOfString:@"\n"withString:@""];

        successBase64String = [successBase64StringstringByReplacingOccurrencesOfString:@"\r"withString:@""];


普通的base64 

 NSString * success =  [CALLBACKSUCCESS stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];

你可能感兴趣的:(safe base64)