【发布时间】:2018-05-01 11:27:01
【问题描述】:
我在应用程序委托类中创建了全局字符串,并在我的应用程序控件移动时将字符串附加到多个类中,但我只得到最后一个附加的字符串。
@property (nonatomic , strong) NSString *strConacatResponse;
在 appdelegate.m 中
self.strConacatResponse = [self.strConacatResponse stringByAppendingString:[NSString stringWithFormat:@"Name : %@ ",name]];
然后在另一个班级
NSString *strDates = [NSString stringWithFormat:@"\n Common utilities not expire *** EndDate: %@ *** StartDate: %@ ",paramEndDate,paramStartDate];
[AppDelegate sharedAppDelegate].strConacatResponse = [[AppDelegate sharedAppDelegate].strConacatResponse stringByAppendingString:strDates];
在我的第三节课
NSString *strTemp = @" \n Database getSuscriptionStatus error in api calling of apple ";
[AppDelegate sharedAppDelegate].strConacatResponse = [[AppDelegate sharedAppDelegate].strConacatResponse stringByAppendingString:strTemp];
但只得到最后一个字符串
【问题讨论】:
-
你能展示sharedAppDelegate方法吗?
-
最后一个字符串是什么意思?请问你得到的确切字符串是什么?
标签: objective-c nsstring