Questions tagged [nsarray]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
25 views

Defining the type of a completionHandler in Objective-C

I can't manage to get the responseCompletion type correct, at the for cycle. Tried to replace it with typedef, but got no luck, only more errors. @interface ImageManager : NSObject //typedef void(^...
bruno's user avatar
  • 2,180
0 votes
0 answers
31 views

Core Data using NSArray does not preserve any data after program termination

I'm attempting to configure the transformer to preserve array objects. It was successful to create new data after refreshing data, however when I killed the program and then reopened it, the data was ...
Travgalax's user avatar
0 votes
0 answers
10 views

Make Multiple Selections in iOS App Based off Data from Parse Server

My Parse server includes a class of songs. The data from this is Song name, and up to 6 different verses, where each is a string of text. It's set up to be like entry[@"SongName"] and entry[@...
user717452's user avatar
1 vote
1 answer
74 views

How to read an objective-c array in swift? Its always returning nil

I have a NSArray declared in .h file as @interface ClassName : NSObject { NSArray *myArray; } @property (nonatomic, strong) NSArray *myArray; @end In the .m file here is how I have it. @...
vedhanish's user avatar
  • 251
0 votes
1 answer
60 views

Errors on [indexPath!] and [newIndexPath!] - the message "Cannot convert value of type 'NSIndexPath?' to expected element type 'IndexPath'

// Errors on [indexPath!] and [newIndexPath!] ---- the message "Cannot convert value of type 'NSIndexPath?' to expected element type 'Array<IndexPath>.ArrayLiteralElement' (aka 'IndexPath')&...
iThinkBig's user avatar
1 vote
1 answer
53 views

Complex Dictionary Get Values as Strings With Conditions

I have built a survey using laanlabs/SwiftSurvey and I am able to get the results from the surveyComplete method as a dictionary. The results return in a complex structure and I need to get the values ...
Justin Erswell's user avatar
0 votes
0 answers
56 views

Accessing string and int values from JASON data

Parsing a JSON file saved locally,storing JSON data in NSArray and further NSArray storing in id type to print values in table view but getting crash in getting int value like "id" also what ...
user3432634's user avatar
0 votes
0 answers
21 views

I am trying to pull the value based on the key in a NSArray in Objective-C that are passed in a URL. How do I get the value form the key? [duplicate]

I am pulling in the components from a NSURL using componentswithurl: resolvingagainstbaseurl:. This gives me an NSArray of query items, but I cannot get the value for each object out of the array ...
D. Rock's user avatar
1 vote
1 answer
281 views

Swift Printing an Array in a table form String and also adding special characters

Lets assume i have this string var stringCSV = "Beth,Charles,Danielle,Adam,Eric\n17945,10091,10088,3907,10132\n2,12,13,48,11"; And i converted it into a 2D Array [["Beth", "...
BigFire's user avatar
  • 327
0 votes
0 answers
198 views

How copy an NSArray into MLMultiArray in Swift?

I have an NSArray of size (1, 5, 401) from a plist file. I want to copy that into MLMultiArray of the same shape and then pass it to a CoreML model in Swift. How can I copy the values from NSArray to ...
user3157047's user avatar
0 votes
0 answers
40 views

Iteract through __NSSingleObjectArrayI in Objective-C

I'm getting the below response and how do I iterate or get the values? <__NSSingleObjectArrayI 0x600002edeea0>( { link = "<null>"; ValueG = "%"; ValueT = 1; ...
Microcad's user avatar
-2 votes
1 answer
74 views

Parse JsonArray response data

I have an json array respone like this; [ { "id": 62, "type_id": 1, "coordinate": { "x": 2273.73828125, &...
uyarc's user avatar
  • 597
0 votes
0 answers
34 views

Plotting values from an NSArray in MapKit

Edit: added Dump(lat) Edit2: tried compactMap I am having trouble retrieving values from an SQL database and plotting longitude and latitude from each row in the database as a new pin on the Map. The ...
user1378824's user avatar
0 votes
1 answer
99 views

Xamarin iOS - Why Can't I Iterate or Fetch by Index on an NSArray?

I am trying to either iterate over an NSArray in Xamarin, or fetch items by index as follows : try { NSData value = (NSData)NSUserDefaults.StandardUserDefaults["accounts"]; ...
GuybrushThreepwood's user avatar
0 votes
1 answer
80 views

NSDictionary count of objects (0) differs from count of keys (1) Crashing app after new Xcode

I have an app which will take a plain text file, and for each question, create an entry in a PLIST file with different choices for answers, etc. I have used this same code for a few years, but for ...
user717452's user avatar
2 votes
3 answers
330 views

Rust Cocoa - How to Iterate NSArray

From brandonhamilton/image-capture-core-rs's ICCameraDevice.mediaFiles() I can get the NSArray::count() (from core-foundation-rs) : let cam_media_files = camera_device.mediaFiles(); println!( ...
Mikeumus's user avatar
  • 3,630
-1 votes
1 answer
60 views

Get Contents of Files In Array on iOS

On my iOS app, I need to look through one of the document directories which has stored multiple created PLISTs. Each PLIST simply contains an Array of names. What I need to do is for each PLIST, get ...
user717452's user avatar
0 votes
1 answer
135 views

NSSet with string property from array of objects

I have an array of somethings, I'd like to make a set from an NSString property on this object: @protocol something<NSObject> @property(nonatomic, readonly) NSString *Id; @end I have an array ...
Rik's user avatar
  • 1,894
2 votes
1 answer
1k views

Convert NSSet into an Array

I'm storing data in a CoreData entity that uses relationships. By default a toMany type relationship will be of typeNSSet. In order to load this NSSet into a tableview in the order in which the items ...
unknown's user avatar
  • 828
1 vote
1 answer
63 views

how can the whole NSMutableArray be filled with the same object(NSString)

I'm trying this, but it looks like it's not right, are there any options? Thank you NSMutableArray *copyy = [[NSMutableArray alloc] initWithCapacity:8]; for (int i = 1; i < copyy.count; i++) { ...
juicexxx's user avatar
0 votes
1 answer
30 views

Do NSArray and NSMutableArray classes take up the same size in memory?

I'll have to work with millions of representations stored as indexes in multiple NSArray objects or NSMutableArray objects. Which one of these classes takes up the least memory?
Vulkan's user avatar
  • 1,004
0 votes
1 answer
110 views

How to parse this type of data to a JSON in Swift?

I have called an API to get all holidays in a year, it came out a Json type. But I only can extract it like below (it is one of many elements of "items") "items": [ { "...
Nguyễn Nhật Trường's user avatar
0 votes
1 answer
145 views

How to retrieve specific value from an array

I am making a request to an API and the results being returned is an array. The issue I have is that the only value I am interested in is the elevation. However, if I append the results to an array, ...
Chris's user avatar
  • 247
0 votes
1 answer
119 views

How to pair strings together from NSArray? [duplicate]

I have a NSArray that looks like this: NSArray *array = {@"1.100.2", @"23465343", @"1.100.1", @"46535334", @"1.0.03", @"24353454" ...}; I ...
CokePokes's user avatar
  • 981
0 votes
0 answers
90 views

NSPredicate - Show exact match first

I have a following array NSArray *arr = [NSArray arrayWithObjects: @"Suresh", @"Dr. Akshay Phulare", @"Akshay", ...
Akshay Phulare's user avatar
0 votes
1 answer
114 views

Merge two NSMutableArray in Swift

I have two NSMutableArray: let value = data as NSDictionary let array_item : NSArray! = (value.value(forKey: "mids") as! NSArray) if let array = array_item { ...
simojo's user avatar
  • 13
0 votes
0 answers
24 views

Insert unique item to NSArray

I've implemented a simple code that used to insert unique items to NSArray object. Meaning that If the item already exists, it won't be added again to avoid duplications BOOL identicalItemNotFound = ...
Zohar81's user avatar
  • 4,752
0 votes
1 answer
74 views

Sorting NSArray and NSMutableArray in Objective-C

I have an NSArray containing 6x 3D arrays with image pixel data, and an NSMutableArray with 6 values. I would like to sort the NSMutableArray array numerically and sort the NSArray in the same order ...
user3470496's user avatar
0 votes
3 answers
255 views

how to replace a single variable of multi element NSArray in Swift

I am struggling to update a single variable in an array create by Structs. struct CurrentPolicyItems { var id:Int var currentInsured:String var currentPremium:String var currentXDate:...
David Sanford's user avatar
0 votes
1 answer
552 views

Reorder NSOrdered Set based on the order specified in a different NSOrderedSet

So, I have two ordered sets and things are structured in a way where one ordered set basically has a list of dictionaries and the other ordered set has strings that correspond with a certain value in ...
David West's user avatar
0 votes
1 answer
58 views

How to check my nsarray contains another nsarray element or not in fastest way IOS

I have seen many of the answers but didn't get my answer. So that's why I decide to post a question. If anybody can find the helpful link or answer will be helpful. Here is my array of dictionary: <...
Mihir Oza's user avatar
  • 2,788
0 votes
1 answer
51 views

How to cancel sortUsingComparator

When the array is sorting, [arr sortUsingComparator:sortByTime] and then I wanna cancel the operation. What should I do?
Walker Qiu's user avatar
1 vote
1 answer
720 views

how to convert a NSArray<NSString*> to std::vector<std::string> and pass it to a c++ function in Obejctive-C?

I am new to Objective C and C++, and I have successfully called a C++ function in Objective C following this tutorial. However, the example function in the above turorial has no input parameters, it ...
user10253771's user avatar
0 votes
0 answers
51 views

I am trying to perform search operation in swift

I have an array of managed object class named as categories In every category, I have NSSet of apCodes I am showing the category name in the table view section and opCodes name in table view rows....
Rahul Bandal's user avatar
0 votes
1 answer
220 views

uncaught exception 'NSRangeException'

I getting crash uncaught exception 'NSRangeException', reason: '*** __boundsFail: index 3 beyond bounds [0 .. 2]' in Objective C crashlytics issues at this line "label.text = [_addressTypeArray ...
Atmakuru Ranjith Reddy's user avatar
0 votes
2 answers
266 views

Objective-C How to add objects to NSMutableArray from other place?

Hello I'm junior in Objective-C and Swift programming. I have NSMutableArray in ExampleMenuViewController.m or(and) SomeClass.m declared as vcTabs. NSMutableArray *vcTabs; When I have two declares '...
handzel's user avatar
  • 91
0 votes
1 answer
194 views

Add an object to a NSMutableArray using arrayWithObject

This is my code: NSMutableArray* notifications = [NSMutableArray arrayWithObjects:myObject.dictionary, nil]; After creating the NSMutableArray I do this: NSData *jsonData = [NSJSONSerialization ...
l000000l's user avatar
  • 330
0 votes
1 answer
51 views

Unable to get the key of a value from an NSDictionary in Xcode

I was trying to get the key of a value by using the value itself from an NSDictionary in my Xcode project. I am using the following dictionary: _itemDictionary = @{ @"Electronics" : @...
Gchammas23's user avatar
0 votes
1 answer
77 views

How to convert items of NSArray to utf16 (char16_t)?

I have a function that gets all contents of directory whether files or directories and I am using contentsOfDirectoryAtPath to collect the content of a directory then I save the names of files/...
Lion King's user avatar
  • 33.2k
1 vote
1 answer
94 views

how can I simply store level data as an array and load it again?

I admit I am a newbee, although I have been writing this for 1.5 years now, I still feel as a beginner sometimes. I am trying to write an action game with a spaceship flying through different levels. ...
ULI's user avatar
  • 41
0 votes
1 answer
793 views

Xcode: XCTest cannot no compare two NSArray of numbers [duplicate]

I'm trying to implement a unit test(XCTest) to compare two NSArray objects: Here is my implementation: - (void)testTwoNumsArrays { NSArray *result = @[@20,@20]; NSArray *expecteResult = @[@20,@...
user2924482's user avatar
  • 8,630
-1 votes
1 answer
29 views

Cannot iterate through array inside array of dictionaries

I'm having trouble parsing a response into workable objects in swift. Basically, this is the response I get (simplified data for viewing purposes) "[{\"CO2\":0,\"Places\":[{\&...
kyrers's user avatar
  • 529
0 votes
1 answer
54 views

Obj-C - Can't access values in NSArray?

I have a textView that displays the string: 255,34,7,4 I'm trying to use the following code to pull the string from my textView, and separate each number into an array: NSArray *array = [self....
Brittany's user avatar
  • 1,319
-1 votes
1 answer
297 views

Convert JSON array of numbers into CGPoints in Objective-C or Swift

I am trying to convert JSON from an API into an array of cgpoints that I can use in core graphics. The JSON looks like: {"date":"2017-01-05","open":119.34,"high"...
user6631314's user avatar
  • 1,761
1 vote
1 answer
245 views

how to print array element line by line using objective c

I want to print array element line by line like periodic table , here is my code.. NSArray* myInfo1 = [NSArray arrayWithArray:allhrStartTime]; [myInfo1 componentsJoinedByString:@"\n"]; ...
Mohammad Arman's user avatar
-3 votes
1 answer
66 views

Creating array of string from the array of dictionaries in swift

I have JSON response as given below: { "status": true, "data": [ { "id": 2, "name": "demo", "last_name": "test" }, { ...
Jekil Patel's user avatar
0 votes
3 answers
472 views

Pass Array from View Controller To View Controller Returns Empty Array

This type of question has been asked and answered, but my specific situation returns an empty array. I first create an array in View Controller 1 (VC1). VC1 includes a collection view. I try to add a ...
JBeesky's user avatar
  • 319
0 votes
0 answers
162 views

NSArray assignments causes "Multiple unsequenced modifications"

I'm assigning elements to an array at compile time (Xcode). The compiler warning ("Multiple unsequenced modifications") implies that the compiler might not compute the assignments in the same order as ...
Jeff's user avatar
  • 2,659
2 votes
1 answer
130 views

NSArray creating a subarray and then summing the values

I have some code that was originally written as: +(double)averageOfArray:(NSArray*)array fromIndex:(int)from toIndex:(int)to{ if (to < 0) return 0; if (to > array.count) return 0; ...
Chase Roberts's user avatar
-3 votes
2 answers
61 views

Having some problem in my calculation with javscript

I am trying to add a the values in an array untill the sum is 1000. I have been trying it using for loop with if condition. but it doesn't stop in according with sum value. example array [110.110.225,...
Arslan Farooq's user avatar

1
2 3 4 5
107