クラス間で基本データを渡すことはできますが、クラスNSString*
からa を渡そうとUIApplicationDelegate
するとEXC_BAD_ACCESS
/が返されNSZombie
ます。
を返すために私がしなければならない特別なことはありNSObject
ますか? これはスレッド化と関係がありますか? (私はatomic
、プロパティの設定がそれを処理すると思いましたか?)
AppDelegate.h:
@interface AppDelegate : NSObject <UIApplicationDelegate> {
NSString * currentNoteName;
}
@property (atomic, assign) NSString *currentNoteName;
@end
AppDelegate.m:
- (void)timerCallback:(NSTimer *)timer {
currentNoteName = [NSString stringWithCString:(tone->freq).c_str() encoding:NSUTF8StringEncoding];
// This works:
NSLog(@"Current Note Name in timerCallback: %@", currentNoteName);
その他のオブジェクト.m:
// Returns a Zombie object & EXC_BAD_ACCESS:
NSString *currentNoteName = [appDelegate currentNoteName];