Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:35:28+00:00 2026-06-13T18:35:28+00:00

I have a MutableArray in NSObject Class i want to pass the NSMutableArray to

  • 0

I have a MutableArray in NSObject Class i want to pass the NSMutableArray to detailViewController then i want to display the NSMutableArray in tableView(detailViewController).In this project i have a two view controller one is firstViewcontroller and detailviewcontroller.the problem is the data cannot pass from NSObject.Give me an idea if you want more Information Please ask.

peripheralmanager.m

- (void)centralManager:(CBCentralManager *)central 
didDiscoverPeripheral:(CBPeripheral *)peripheral 
 advertisementData:(NSDictionary *)advertisementData 
              RSSI:(NSNumber *)RSSI
{

  NSLog(@"didDiscoverPeriphera.peripheral: %@ rssi: %@, UUID:%@ advertisementData:%@", peripheral,RSSI,peripheral.UUID, [advertisementData description]);

  targetPeripheral = peripheral;
  peripheral.delegate = self;
  //  [[centralManager retrievePeripherals:NSArray arrayWithObject:(id)peripheral.UUID] ];
  //  rssilabel.text=[RSSI stringValue];
  if (!peripheral.isConnected)
  {
  [centralManager connectPeripheral:peripheral options:nil];
  }
  // MeBleAppDelegate *appdelegate=(MeBleAppDelegate *)[[UIApplication sharedApplication]delegate];
  MeBleDetailViewController *obj=[[MeBleDetailViewController alloc]init];
  // MeBleDetailViewController *obj=[[appdelegate sharedappdelegate].navigationController objectATindex:MeBleDetailViewController];
  obj.dataArray=self.mutableArray;
  [self.mutableArray addObject:peripheral];
  printf("New UUId,addin\r\n");

}

detailviewcontroller.m

- (void)viewDidLoad
{
  //NSMutableArray *dataArray=[[NSMutableArray alloc]init];
  [super viewDidLoad];
  NSLog(@"%@",self.dataArray);
  NSLog(@"%@",objCurrentDevice.mutableArray);
  //  PeripheralManager *peripheralmanager=[[PeripheralManager alloc]init];
  self.label.text=[NSString stringWithFormat:@" %@ ",dataArray];
  // Do any additional setup after loading the view.
  // [self.dataArray addObject:objCurrentDevice.mutableArray];

  appDelegate.arrDevices=dataArray;
  appDelegate = [[UIApplication sharedApplication] delegate]; 
  // write below line in any function in this file
  // NSLog(@"%d",[appDelegate.arrDevices count]);  
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  static NSString *simpleTableIdentifier=@"Cell1";

  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
  if(cell==nil)
  {
    cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}

    cell.textLabel.text=[dataArray objectAtIndex:indexPath.row];
     //  PeripheralManager *objtemp=[[dataArray objectAtIndex:indexPath.row]deviceName];
     NSLog(@"%@",objCurrentDevice.deviceName);
    return cell;
}

Error Message

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '***    -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

*** First throw call stack:

(0x356c888f 0x37a6f259 0x3561d1d7 0x164db 0x33135c8b 0x331421e9 0x33142059 0x33141f3f 0x331417c1 0x33141503 0x33135aff 0x331357d5 0x331ae903 0x33228627 0x351e2933 0x3569ca33 0x3569c699 0x3569b26f 0x3561e4a5 0x3561e36d 0x372ba439 0x3312acd5 0x1500f 0x14fb4)

terminate called throwing an exception(lldb) 

I want output like this image..Please Give an idea..Please Ask Me for More Information.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:35:30+00:00Added an answer on June 13, 2026 at 6:35 pm

    You can use Designated intializer to solve this issue

    In your FirstViewController

    -(id)initwithData (NSArray*)array
    {
      //store the data in array
    }
    

    In the DetailedViewController you can call this method..

    MeBleDetailViewController *obj=[[MeBleDetailViewController alloc]initwithData:yournsarrayname];
    

    You can see your array will be loaded with the data

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom class of type NSObject that contains a single NSMutableArray. This
I have this method in my Car.h class file: @interface Car : NSObject {
have written this little class, which generates a UUID every time an object of
I have a class (from NSObject ) that contains: NSString name int position float
In my application I have One MutableArray comes like this, Idlist:( 1, 2, 3
I have an tableview which is loaded from a mutablearray as listed below. However
I have two simple NSMutableArray that consists of few objects. Some of these objects
I have the following declarations in my model.h: @interface Model: NSObject { NSMutableArray *myMutableArray;
I have a method that returns a NSMutableArray.. I am calling this method from
I have this mutable array: myIntegers = [NSMutableArray array]; [myIntegers addObject:[NSNumber numberWithInteger:indexDelete - 1]];

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.