Iam pretty new to Objective c,Iam unable to add NSmutable array contents to NSarray here.
    - (void)viewDidLoad {
    markarry=[[NSMutableArray alloc]init];
HolidayAppDelegate *delegatObj = (HolidayAppDelegate *)[UIApplication sharedApplication].delegate;
for (int i=0;i<[delegatObj.Datearray count]; i++) {
    NSString *Str=[delegatObj.Datearray objectAtIndex:i];
    NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"MMMM-dd-yyyy"];
    [dateFormatter setTimeZone:gmt];
    NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
    [dateFormatter setLocale:usLocale];
            NSDate *dateFromString;
    dateFromString = [dateFormatter dateFromSt开发者_开发技巧ring:Str];
    [markarry addObject:dateFromString];
    [dateFromString release];
    [Str release];
}
 }
I need to add markarry contents to the nsarray. Thanks
Very Simple
NSArray *newArray = [NSArray arrayWithArray:markarry];
UPDATE
Ok it seems your string is nil when you create it using dateformatter. Try to debug your app you will find the solution.[dateFormatter setDateFormat:@"MMMM-dd-yyyy"]; the format you are using here mmust be same as the string as. Otherwise you will get nil in your dateFromString object.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论