我有一个不寻常的问题,我不知道为什么:
我有以下方法:
- (NSString*) copyAndReplaceOccurencesForProfileFromString: (NSString*)initialString toString:(NSString*)aString
{
aString = [NSString stringWithString:initialString];
DLog(@"PROFILE INITIAL HTML STRING: %@", initialString);
aString = [aString stringByReplacingOccurrencesOfString:@"//PROFILE_IMAGE//" withString:profileImageForHTML];
aString = [aString stringByReplacingOccurrencesOfString:@"//PROFILE_NAME//" withString:profileBirthNameString];
aString = [aString stringByReplacingOccurrencesOfString:@"//PROFILE_BIRTHDATE//" withString:profileDateOfBirthString];
return aString;
}
像这样调用:
NSString *profileSection = [NSString string];
[self copyAndReplaceOccurencesForProfileFromString:htmlBody_profile toString:profileSection];
DLog(@"PROFILE MODIFIED HTML STRING: %@", profileSection);
但“profileSection”字符串返回空。
我必须指出,在调用 return 之前,“aString”中有值。
知道为什么会这样吗?谢谢 !