Questions tagged [nsarray]

An immutable, integer-indexed array of objects from the Apple Foundation framework.

An NSArray object manages an immutable array; once you have created the array, you cannot add, remove, or replace the objects in the array. You can, however, modify the individual elements themselves (if they support modification). The mutability of the collection does not affect the mutability of the objects inside the collection. You should use an immutable array if your data rarely changes, or changes all at once. Consider using a mutable array () if your data changes frequently.

Resources:

5346 questions
1
vote
2 answers

how to add different object form my nsarray to nsstring

I am having a mutable array which has differnt value at differert index such as at index value 0 Hi 1 this 2 is 3 iphone 4 testing. So at differnt index ,array has different string…
abhi.shah88
  • 193
  • 1
  • 9
1
vote
2 answers

Why there is No constant NSArray Literal and NSDictionary Literal

As apple Introduced a new syntax for array literal and dictionary literals: NSArray* literalArray = @[@"1", @"2", @"3"]; //Dictionary Literal NSDictionary* literalDictionary = @{@1:@"first", @2:@"Second", @3:@"Third"}; They are not behaving like…
Saurav Nagpal
  • 1,247
  • 1
  • 10
  • 27
1
vote
0 answers

NSArray element failed to match the Swift Array Element type - xcode 8.1

Though the same question has been asked many a times and the answers were to --> Typecast the array to the required array of class type. Though i did it typecasting I am still facing the same error with the crash. Here is my code: let data =…
Manju Basha
  • 665
  • 1
  • 9
  • 29
1
vote
1 answer

Swift3: not the expected contextual result type NSArray

I am migrating my code from Swift 2.3 to Swift 3. Before it was working fine after migrating I am facing not expected contextual result type NSArray Here is my code func setConfirmedBookingsAfterSorting() { if let bookings = …
srinitha
  • 119
  • 10
1
vote
1 answer

NSPredicate for filter objects whoes string is BEGINSWITH special characters

I have one scenario where I want to filter the objects of NSArray who have NSDictionary object and every object have key name. I want to filter with that number of objects whose name key value should be starting with special characters or numeric…
Ravi B
  • 1,574
  • 2
  • 14
  • 31
1
vote
1 answer

How to map child array from the response JSON using object mapper?

I'm using Alamofire, and Alamofire Object Mapper. Think this is the response from the web service: { "status": 200, "error": false, "response": { "id": 9, "parent_id": 0, "company_id": 1, "image": "", "name": "Games", …
bill
  • 854
  • 3
  • 17
  • 41
1
vote
1 answer

NSArray of NSStrings. Sort by relevance. Best practice

I have a NSArray of NSStrings. For example: @"Good item", @"Very good item", @"The best of the best item" Upon searching on UITextField, the user types @"Very good item". I need to sort the source array by relevance and would like to see result…
Igor Jorin
  • 141
  • 10
1
vote
2 answers

How do I add an NSArray of NSDictionaries to a AFJSONRequestSerializer request?

I wrote some code to put a NS(Mutable)Dictionary in a NSArray. But after adding the dictionary to the array, it seems it creates separate dictionaries for each key-value pair. See example below. NSMutableDictionary *info = [[NSMutableDictionary…
Angelo A
  • 2,744
  • 6
  • 28
  • 37
1
vote
2 answers

Searching an NSArray o strings with an NSDate

Hard to get the headline correct since there is so much to tell. I got this NSArray (A portion of it): Mon, 06:00, Radioshow Morning, Mon, 10:00, Lunch radio, 14:00, Afternoon Radio and so on. The NSArray is from an plist in the app. What I need to…
swe_mattias
  • 621
  • 1
  • 8
  • 15
1
vote
1 answer

Defining an NSArray Constant in a Protocol

I have a protocol class where I'm defining multiple String Constants and Array Constants containing these strings. I am porting over an android project. In my Constants.h, I am declaring the NSString & NSArray constants as…
mhorgan
  • 886
  • 2
  • 11
  • 32
1
vote
2 answers

How get objects from one array with same properties of other?

For example: I have two NSMutableArray. One @[1,2,3,4,5,6,7]. Other have objects like @[ @{@idObjectToSearch":1, @"name":@"aaaaa", @"surname": @"bbbbb"}, @{@idObjectToSearch":2, @"name":@"aaaaa", @"surname": @"ccccc"}, ... …
Viktorianec
  • 361
  • 6
  • 22
1
vote
5 answers

-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x9d0d720

- (void)connectionDidFinishLoading:(NSURLConnection *)connection { [jsonArray removeAllObjects]; NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; responseData = nil; …
Abhimanyu
  • 61
  • 3
  • 10
1
vote
3 answers

Multiple Loop Variables in For Statement in Obj-C

Is there a way to have multiple loop variables in a for statement? Here would be a hypothetical representation of what I'm talking about: for (NSString *foo in bar; NSString *bob in example) {} If not what is a good way to accomplish…
Kolin Krewinkel
  • 1,376
  • 11
  • 12
1
vote
4 answers

NSArrayM objectAtIndex: index 6 beyond bounds

I am developing iOS application. Value store on Array, but when I run app, its crashes with array index out of bounds. Please Help and Thanks in advance.. Code: daysOfWeek = [NSArray…
1
vote
1 answer

how to load array of content to dictionary type

i have a array with data,i want to load the dictiionary type element with array...... NSArray *thisArray = [[NSArray alloc] initWithContentsOfFile:path]; NSSdictionary *state; how to load the content with array.... any help appreciated...
Linux world
  • 3,750
  • 11
  • 44
  • 59