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
3 answers

Append to array in swift - has no member append?

What am I doing wrong in this code? and why do I get the error ? "Value of type 'NSMutableArray' has no member 'append'" static func saveUserData() { let item:NSDictionary = ["TIME":"12:00","LOCATION":"here"] let paths =…
chewy
  • 8,207
  • 6
  • 42
  • 70
1
vote
2 answers

Accessing string within an array within a plist iphone

I have a plist with root of type dictionary containing keys of type array, and each array has three items of type string. I want to access the strings and pass them to a view controller. This line is successful in my cellForRowAtIndexPath…
Nungster
  • 726
  • 8
  • 28
1
vote
2 answers

Dynamic rows for each section

How to calculate number of rows for each section and populate it's data. Below is the data. <__NSCFArray 0x7fadb3e73a60>( { AMID = ""; AMName = "xyz"; records = ( { EId = 100; …
user3310076
  • 133
  • 12
1
vote
1 answer

Find numbers in array that appear 2 or more times

I need to find duplicated numbers (that appear 2 or more times) in array how can I do it without using NSCountedSet? This is a solution I did: NSCountedSet *countedSet = [NSCountedSet setWithArray:array]; __block NSUInteger totalNumberOfDuplicates =…
Lipatov Eugen
  • 407
  • 3
  • 10
1
vote
1 answer

How to store values at key =0 into nsarray?

I want to store all the emails into an array. What do I need to do for the same ?
Gurp321
  • 109
  • 2
  • 11
1
vote
4 answers

Find NSDictionary containing specific value in NSArray (iOS)

I have a NSArray("address_components") of multiple NSDictionary. Each NSDictionary contains one NSArray("types") of NSString values. Like this.. "address_components" = ( { "long_name" = "Perumbavoor Puthencruz Road"; "short_name" =…
1
vote
1 answer

How to get last element from NSMutableArray in which status as complete?

I have an array of dictionaries in following format [ { "status":"not completed", "rating":2 },{ "status":"completed", "rating":2 },{ "status":"not completed", "rating":"" },{ "status":"completed", "rating":""},{ "status":"not…
Bangalore
  • 1,572
  • 4
  • 20
  • 50
1
vote
1 answer

Predicate on optional value in swift not working

I am try to predicate on the optional value and it always crash the application with following error. * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ valueForUndefinedKey:]: this class is not key value…
Chirag Shah
  • 3,034
  • 1
  • 30
  • 61
1
vote
4 answers

How to Array Set in TableView With SectionHeaderTitle?

This is my array and i set in TableView with Section Wise.this array is Dynamically so that value is Increase or decrease. Set Date in Header Section Title Same date value is included in One Section. So What is the Method of TableView that i set…
Sanandiya Vipul
  • 764
  • 4
  • 16
1
vote
0 answers

HTTP request and View Controller in Swift

I have this code func presentationlum() { let request = NSMutableURLRequest(URL: NSURL(string: "http://raspberrypi.local/etatlum.php")!) let Session = NSURLSession.sharedSession() request.HTTPMethod = "GET" var JsonDict : NSArray…
S.P98
  • 11
  • 1
1
vote
0 answers

Add Custom Cell Randomly in UITableView

I have a UITableView which is populated with an NSArray. The array is sorted alphabetically in my table with alphabetized headers. I am adding a custom cell randomly in my table at every 10th row. The issue I have is that the custom cell is layering…
Luke Irvin
  • 1,179
  • 1
  • 20
  • 39
1
vote
2 answers

Remove object from NSArray by index

I have a code that removes an object from an NSCollectionView, but it only removes one item. In the NSArray ("array") the value is "2 4" which returns 2, 4. But when I run the code, it only removes "2" and not "4". The Log: Click here for the image…
1
vote
2 answers

Manipulation of string array to get +1 at end

I have an array that contains file names as: NSArray *filename = @[@"anoop", @"anoop100", @"anoop5"]; Now if user creates a new file the new name should be anoop101. What have I tried: I sorted the array in that case anoop5 goes at last and…
Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
1
vote
1 answer

delete element from table view objective c

I have a table view full of data defined from the user. the array is gathered from nsuserdefaults and is show in a table view controller. i am trying to implement a delete function. it looks fine but when i press delete the error comes Terminating…
Kyle Griffith
  • 114
  • 10
1
vote
1 answer

Search / retrieve single value from one to many relationships Core Data Swift

My data design allows one user to have many votes; and each single record can also have many votes. I'm struggling massively with referencing and searching for a specific element relying on these In the master view controller, I've a fetch…
DrWhat
  • 2,360
  • 5
  • 19
  • 33