0

ビュー間でデータを送信したいのですが、エラーが発生します:認識されないセレクター....

デバッガーでは、変数mystringは NSString ではなく NSCFNumber (「現時点で」) です...

allergy_appAppDelegate.h

#import <UIKit/UIKit.h>

@interface allergy_appAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
    UIWindow *window;
    UITabBarController *tabBarController;
    NSMutableArray  *result_array;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@property (copy , readwrite) NSMutableArray *result_array;

@end

viewcontroller.m

        allergy_appAppDelegate *dataCenter = (allergy_appAppDelegate *)[[UIApplication sharedApplication]delegate];
        dataCenter.result_array = [[NSMutableArray alloc] initWithArray:Parser_result];

結果.m

   allergy_appAppDelegate *dataCenter = (allergy_appAppDelegate*)[[UIApplication sharedApplication]delegate];
   show_user_array = [[NSMutableArray alloc] initWithArray: dataCenter.result_array]

for (NSString *mystring in show_user_array) {        
    textView.text = [[textView text] stringByAppendingString:@"\n"];
    textView.text = [[textView text] stringByAppendingString:mystring];
}
4

1 に答える 1

0

インスタンス変数は、_ ではなく、キャメルケースにする必要があります。つまりresult_array、する必要がありますresultArray。クラスは大文字で始まります。

NSString結果の配列がor NSNumber(または必要なもの)のインスタンスでいっぱいですか?

ここで配列をリークしていることを考えると...

    dataCenter.result_array = [[NSMutableArray alloc] initWithArray:Parser_result];

...これが過剰リリースの問題である可能性は低いです。copywithNSMutableArrayはあなたが望むことをしないこと にも注意してください (コンパイラはそれにフラグを立てる必要がありますが、しません)。-copyクラス クラスタのインスタンスの不変のコピーを常に返します。

于 2011-03-24T21:06:53.373 に答える