Bug 15908 - How to get ObjectAtIndex From NSMutableArray
Summary: How to get ObjectAtIndex From NSMutableArray
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.0.4.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-11-04 14:17 UTC by Bhupinder Singh
Modified: 2013-11-04 15:42 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Bhupinder Singh 2013-11-04 14:17:50 UTC

I have a iOS binding project.In that project i have a method connectPeripherals which takes the CBPeripheral 

Object -  dm.peripherals is a NSMutable Array which give the peripheral object at index 0 to connectPeripherals method.

This is what it passes  [dm connectPeripheral:[dm.peripherals objectAtIndex:0]];

The issue is when i call this method in xamarin.ios app project i don't know how i can use ObjectAtIndex property on NSMutableArray Object. Has any done this before ?

Comment 1 Sebastien Pouliot 2013-11-04 15:18:41 UTC
The selector `objectAtIndex:` is available in the `ValueAt` method. However it is not much useful in most cases (except low level code) since it returns an `IntPtr`.

In most case you'll want to use: `public T GetItem<T> (int index)`

That will return you an instance of the type you expect to get from the (untyped) NS]Mutable]Array.

In your above example it means you want a `CBPeripheral` that's located in the first element of your array, so:

    var my_value = my_array.GetItem<CBPeripheral> (0);
Comment 2 Bhupinder Singh 2013-11-04 15:30:30 UTC
Thank You Very Much for your help. I think it likes that thing but when i compiled i got the below exception  :

Error MT5210: Native linking failed, undefined symbol: _sqlite3_bind_blob. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210) 

This is the another story regarding binding project. To elaborate, actually i have a Objective C SDK which has libFile.a, file.db  and header files.  I used objective sharpie to generate the bindings , i know that the error means actually it requires the database file which comes in the sdk. I have added in the binding project but it still gives this error. How do we bind database files as well in the binding project ?

Please let me know if you want this issue to open as new bug report.

Comment 3 Sebastien Pouliot 2013-11-04 15:42:26 UTC
Please do not re-open bug unless (a) the same issue is not fixed or (b) it regress in the future. Otherwise reports gets very confusing and the state of an issue is difficult to determine.

Your new issue does not sounds like a bug - it looks like your bindings instructions are incomplete. Please refer to the documentation or contact support (see the customer portal for the email address) if you require assistance.