Questions tagged [nsmutablearray]
NSMutableArray represents a modifiable (mutable) array object for Cocoa and Cocoa Touch. It is Available in OS X v10.0 and later
5,311
questions
0
votes
0
answers
49
views
Assign double variable to mutable array
I can't figure out why variable number is not being assigned to array self.items.
In the debugger it is showing value of NULL.
-(void)pushItem:(double)number{
[self.items addObject:[[NSNumber ...
0
votes
0
answers
31
views
Array multiplication in Objective-C, for NSArray and NSMutableArray
In Python, the expression 2*[a,b,c] (with a,b,c variables) is meaningful, and returns [a,b,c,a,b,c]. Also, in Python, lists (or arrays) are mutable by design.
It is easy enough to write a category on ...
0
votes
1
answer
33
views
How to test for an uninitialized mutable array
I have corrupted a single object in a file. When I load in the file, one of my mutable arrays (1) contains another mutable array (2) (loaded from the same file) which is uninitialized. When I try to ...
0
votes
0
answers
40
views
Syntax to access objects in my NSMutableArray
I have 2 objects in an NSMutableArray one is a CBPeripheral object and the other is an NSString.
Here you can see that the NSMutableArray contains the two objects:
Then, in line 1249, I try to assign ...
0
votes
1
answer
252
views
Reading Character Array from Shared class in KotlinMultiPlatform (KMM)
How can I properly read the data from a mutable array in Swift from a Kotlin Module?
Kotlin Shared Module:
data class Tape(private val capacity: Int) {
val reel: MutableList<Char>
...
-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 ...
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++) {
...
0
votes
0
answers
39
views
Section not saving moveRowAtIndexPath objective c
I've seen a lot of examples, but I still havn't managed to get mine working.
I have 1 array I'm populating from NSUserDefaults. Everything works as it should. However I wanted the ability to move a ...
1
vote
2
answers
615
views
Swift: subclass NSMutableArray
I'm trying to subclass NSMutableArray in Swift to provide bridge functionality for a Swift array to some old Objective-C codebase. However, I can't find a functional example and all my attempts have ...
1
vote
0
answers
60
views
Adding additional view to front of hierarchy of TableViews
I have a table view which goes city => building type => calculation. Excerpt of code below.
I want to add additional view at front so it goes region => city => building type => ...
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?
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 {
...
0
votes
1
answer
30
views
NSMutableDictionary not updating the tableView
I have this this code to edit/delete car
- (void)dismissViewWithIndex:(NSInteger)index selectedVehicle:(NSInteger)selectedVehicle toDelete:(BOOL)toDelete {
if (toDelete && [self.cars count]...
-1
votes
1
answer
795
views
Change value of a particular key in array of dictionaries in SWIFT
Am new to swift and am using an array of multiple dictionaries. So i want to change the value of a particular key. Please guide me how to achieve it :
Values In Array :-
[
{
"Start":"2:...
0
votes
1
answer
1k
views
Cannot convert value of type 'NSArray.Element' to expected argument
I have a static library writen in Objective C where I have a protocol to get the callbacks of monitoring for regions results.
@protocol ScanBeaconsDelegate <NSObject>
@required
- (void) ...
0
votes
1
answer
554
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 ...
1
vote
0
answers
120
views
How can I record Stereo in iOS 14 Objective C
How can I record Stereo in iOS 14 Objective C
here is my code I don't now how I will add AVAudioSessionPolarPatternStereo to my code
I found the simple code for Swift but I need to add in my objective ...
0
votes
1
answer
202
views
Modify an array of json objects
I have a list of json objects which I need to modify the values within each of them. I'm accessing this list of json objects in the below piece of code:
if let json = try JSONSerialization....
0
votes
0
answers
44
views
How to reference an array from another function Objective-C
I have declared array in SomeClass.h It's a global variable isn't it?
@property (nonnull, nonatomic, retain) NSMutableArray *additional_tabs;
Below I declared 2 function where I use this array.
- (id ...
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 ...
0
votes
3
answers
102
views
Combine Two NSMutableArray In Objective c
I have Two NSMutableArray Array I want to combine this array in to old one array.
How can i do this without any loop (for, while).
NSMutableArray *oldArray = [[NSMutableArray alloc]init];
...
0
votes
0
answers
44
views
How to remove data from an array comparing using string not an index in objective-C
I have an array of dictionary like below
self->arrField: (
{
fieldname = "Have you ever had any one of the following:";
fieldvalue = (
...
0
votes
2
answers
83
views
Sort NSMutableArray in tableview using Objective-C
So I have a small project with a table view. Its cells are populated from another view controller that saves the text/date to user defaults.
Everything works, however, I'm looking to sort the table ...
-1
votes
1
answer
50
views
how can i add one NSMutablearray to another empty NSmutablearray?
I am using NSMutableDictionary for storing data into key value pair and append these dictionary to NSMutableArray.I want to assign my filtered NSMUtablearray to another empty NSMUtablearray, but can ...
0
votes
0
answers
167
views
SwiftUI doesn't refresh with an array initialized by a pointer or a NSMutableArray
I know, this is a very unusual thing to do, but I noticed that SwiftUI view won't update when a @State property is assigned from a pointer:
struct ContentView: View {
@State private var numbers: [...
0
votes
0
answers
147
views
Changing from NSMutableArray to AnyHashable
I'm currently migrating a project from Objective C to Swift 5.2. I have the following line in Objective C:NSMutableArray *arrNewList = [[responseObject objectForKey:@"Result"] mutableCopy];, which ...
1
vote
1
answer
146
views
Objective-c Non Arc Object
I'm managing an old Objective-c Project that still uses Non Arc, I noticed in Fabric Crashlytics for EXC_BAD_ACCESS KERN_INVALID_ADDRESS crash in the application.
This is the trace to the crash, I ...
0
votes
1
answer
156
views
Obj C - NSMutableArray containsObject return true
NSMutableArray containsObject returns true even the address and data is different.
I've seen this post NSMutableArray containsObject returns true, but it shouldnt
already but still I'm not finding ...
0
votes
1
answer
143
views
Is there a way to access an object of an NSMutableArray using Swift?
My group and I are writing a space shooter game. We store the player and hazards in and NSMutableArray called objects. I just finished writing a function to control the players movement using tilt ...
0
votes
2
answers
112
views
Swift code problem - trying to cast objects out from a NSMutableArray as a custom object
Here is my code and it fails to execute as noted below.
I am trying to cast an object to my custom data type called UserData.
First problem I have is don't understand how to get the value out of the ...
0
votes
1
answer
2k
views
Could not cast value of type 'Swift.__SwiftDeferredNSArray' (0x104cd8ae8) to 'NSMutableArray' (0x7fff87c52960)
Below line of code is producing the error,
let response1 : NSMutableArray = NSMutableArray.init(array: (JSON.object as! NSMutableArray).value(forKey: "media_list") as! NSArray)
As the error says I ...
0
votes
2
answers
360
views
App crashes when I use NSPredicate to filter my Array for my UITableView
I am using NSPredicate for search record from the tableView.
Below is my code which I have implemented.
-(void)updateSearchArray:(NSString *)searchText {
if(searchText.length==0) {
...
1
vote
2
answers
61
views
How to check my NSString is exist in my NSMutableOrderedSet?
I am getting below response from the one of the third party SDK, Now how to check that my String value is exist in the response? And the key I need to compare with friendlyName key.
channelList = (...
0
votes
1
answer
311
views
Associated objects and Swift arrays
I have an associated object on a view extension that contains an array (a mutable array in this case).
var queue: NSMutableArray {
get {
if let queue = objc_getAssociatedObject(self, &...
0
votes
1
answer
50
views
Filter NSMutableArray of dictionary with an exact int dictionary value in Objective-C
I have a NSMutableArray containing nsdictionary objects.
`[
{
"IId": 0,
"BookSLNo": 0,
"RollNoOrEmpId": "0",
"BatchId": 38,
"Batch": "NA",
"UserId"...
0
votes
1
answer
40
views
NSDictionary values changes without any modification
I added an NSDictionary to NSMutableArray.
for (TblFiles *objTblFile in visitorFilesArray) {
NSData *fileDataTemp = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: objTblFile....
0
votes
1
answer
542
views
Move and/or Remove Markers in ArcGIS Graphics Layer
I'm using the ArcGIS 100.6 iOS SDK and am populating the map with markers on a Graphics Overlay Layer
whose locations are stored in a database common to all users of my application. Each marker is ...
0
votes
1
answer
209
views
Error: value of type 'Optional<NSMutableArray>' has no subscripts Array[0] in Swift iOS
I am fetching some data from my Objective C classes. Here is my 'dataArray' data:
Optional(<__NSArrayM 0x2818cff60>(
{
date = 1574164423;
shakeState = 1;
},
{
date = 1574164431;
...
0
votes
1
answer
55
views
Does Nssortdescriptor convert contents of the array to integer after sorting?
Given the below code, in the first iteration the logs are displayed normally. For the second iteration the app crashes with the following error message:
019-11-07 09:54:08.156277+0100 xxxion[520:...
0
votes
1
answer
119
views
How to create NSMutableArray in which objects follow protocol?
How to create NSMutableArray in which objects follow protocol?
For example in swift I can do something like:
var array:[MyProtocol] = []
How to implement that in objC
0
votes
2
answers
919
views
Search in NSMutableArray
I am wanted to make a search on NSMUtableArray with key values to catch the hole object not just an array of values so for example my NSMUtableArray return me
{id : 1, name : x1}
{id : 2, name : x2}
...
0
votes
1
answer
103
views
TableView from JSON file - sort data
Hi everyone I'm working with a JSON file to populate a UITableView.
The JSON file has two fields that I need to use:
- "First name"
- "region"
The "region" fields must be assigned for the creation ...
0
votes
2
answers
83
views
NSMutableArray new with Protocol type
How do I get rid of the warning and not use [@[] mutableCopy]:
//Incompatible pointer types assigning to
'NSMutableArray *' from 'NSMutableArray *'
@protocol Coordinatorable <NSObject>
@...
1
vote
1
answer
106
views
UIViewPropertyAnimation Objective C question
I'm following WWDC 2017 where explains how to use UIViewPropertyAnimation to manage UIPanGesture on a ViewController.
My project is entirely Objective C not Swift.
I wanted to have a clarification ...
-1
votes
1
answer
47
views
Getting index of minimum double value within NSMutableArray
I need to get the minimum value (and its index) among objects inside an NSMutable double array.
I get the minimum value correctly but I cannot get its index. A weird and very high number comes up. ...
0
votes
1
answer
57
views
Crash interacting with NSUserDefaults and NSArray
I have an NSMutableArray in which I am adding objective and storing in user defaults, but while adding it is crashing.
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"bssidObserverArray"]) ...
0
votes
0
answers
124
views
How can you convert an NSImage to an NSMutable Array in Objective C?
I have an NSImage which I need to convert to an NSMutable Array of the same size.
I originally converted an NSMutableArray to NSImage, resized, converted to CVPixelBuffer, and fed into a coreML ...
1
vote
0
answers
407
views
Resizing NSMutableArray in Objective-C for passing into coreML model
I am trying to load a 2d image stored as an NSMutableArray (of semi-random sizing), resize the array to 512x512, and then feed into a coreML model as an Image (Grayscale 512x512)for prediction. Is ...
1
vote
1
answer
51
views
In Objective-C, How to initialize NSMutableArray with objects in another NSMutableArray using tableView reference
Developing for MacOS, I have an NSMutableArray namesArray[] that contains 3 String objects.
namesArray[] is represented in a tableView, where user can select multiple cells, each cell represents a ...
1
vote
3
answers
881
views
How to Sort a string date array
I want to sort an array in ascending order. The dates are in string format
Optional(["2019-07-08", "2019-07-09", "2019-07-10", "2019-07-11", "2019-07-12", "2019-07-02"])
I am trying using below code ...