将NSArray添加到NSMutableArray

use*_*827 -1 objective-c nsmutablearray nsarray

我想将NSArray添加到我的NSMutable(appdelegate中的init)

这是我的代码,每次按下按钮(男性,女性,情侣)时都会调用该方法,因此必须将NSArray添加到MutableArray中,但我不知道我尝试过但不起作用.:

     - (void) sexChoosen:(NSString *) sexe
{
    NSError *err;
    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Boxes" inManagedObjectContext:context];
    [request setEntity:entity];

    NSArray *arrayForPredicate = [context executeFetchRequest:request error:&err];
    NSPredicate *sex;

    sex = [NSPredicate predicateWithFormat:@"sexe = %@", sexe];

    NSArray  *BoxWithSex = [arrayForPredicate filteredArrayUsingPredicate:sex];
    //NSMutableArray* tmp = [self createMutableArray:BoxWithSex];

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NSLog(@"FIRST  %@", appDelegate.myArray);

// HERE IS THE CODE TO ADD THE ARRAY TO MY NSMUTABLE ARRAY = AppDelegate *appDelegate

    NSLog(@"SECOND %@", appDelegate.myArray);

}
Run Code Online (Sandbox Code Playgroud)

Phi*_*lls 7

从NSMutableArray 文档:

"addObjectsFromArray:将另一个给定数组中包含的对象添加到接收数组内容的末尾."