nsmutablearray

Objective C - addObject to store array return extra bracket for me how to remove

梦想的初衷 提交于 2019-12-13 21:07:45
问题 my data coming in this format ( ( Male, Female ), ( First, Second, Third ) ) and I want in this format ( Male, Female ), ( First, Second, Third ) how to remove extra bracket from array if ([[allObject objectForKey:@"Fid"] isKindOfClass:[NSArray class]]) { NSArray *arr = (NSArray *)[allObject objectForKey:@"Fid"]; for (int i =0; i<arr.count; i++) { if ([[arr valueForKey:@"Values"]objectAtIndex:i] != (id)[NSNull null] ) { NSMutableArray *fetchArray = [[NSMutableArray alloc]init]; [fetchArray

Convert NSString into NSMutableArray

≡放荡痞女 提交于 2019-12-13 18:17:02
问题 I am trying to convert (or copy?) a NSString into a NSMutableArray. I guess my problem is that I don't really understand the structure of a MutableArray. In my limited knowledge, an Array could look like this: NoteBook = [[NSMutableArray alloc] init]; for (int temp = 0; temp < 3; temp++) { [NoteBook insertObject:@"Page" atIndex:temp]; } Which would give me an Array of PagePagePage . Let's assume I wanted to open a txt file which contains PagePagePage, but the words were separated by a defined

How can I Attached NSMutableArray Data With E-mail Body?

限于喜欢 提交于 2019-12-13 18:13:25
问题 I am trying to attached NSMutableArray data to E-mail body. Here is my NSMutableArray code: NSUserDefaults *defaults1 = [NSUserDefaults standardUserDefaults]; NSString *msg1 = [defaults1 objectForKey:@"key5"]; NSData *colorData = [defaults1 objectForKey:@"key6"]; UIColor *color = [NSKeyedUnarchiver unarchiveObjectWithData:colorData]; NSData *colorData1 = [defaults1 objectForKey:@"key7"]; UIColor *color1 = [NSKeyedUnarchiver unarchiveObjectWithData:colorData1]; NSData *colorData2 = [defaults1

Invoking a WCF method that takes a List of objects. Consumed via an iPhone application

我与影子孤独终老i 提交于 2019-12-13 12:50:56
问题 I have a WCF service that's consumed via an iPhone application. All other methods that accept string parameters or single objects are working fine, however when I invoke a method that takes a " List<CustomObjectClass> ssf ". I am passing an NSMutableArray of CustomObjectClass 's to this method and I'm getting the following error: Any ideas? <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12

Why doesn’t my NSMutableArray subclass work as expected?

[亡魂溺海] 提交于 2019-12-13 12:24:13
问题 I have subclassed NSMutableArray as follows: Base Class: @interface MyBaseMutableArray : NSMutableArray { // Database variables NSString * databaseName; NSString * databasePath; } @property (nonatomic, retain) NSString * databasePath; - (id)initWithContentsOfSQLiteDB:(NSString *)dbTable; -(void) checkAndCreateDatabase; -(void) readFromDatabase; @end Subclass: @interface IngredientsMutableArray : MyBaseMutableArray { } -(void) readFromDatabase; @end When I create an IngredientsMutableArray I

Ambiguous use of subscript

你说的曾经没有我的故事 提交于 2019-12-13 11:34:54
问题 I have a expandable table with custom cells that appear or disappear when a visible row is tapped. The cell's data is stored in a plist and declared as a NSMutableArray. I get an 'ambiguous use of subscript' error in the following code and was hoping somebody else has encountered this and know the fix. I've tried all possible options, to my limited knowledge I must add. var cellDescriptors: NSMutableArray! func getCellDescriptorForIndexPath(indexPath: NSIndexPath) -> [String: AnyObject] { let

Incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *' [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 11:29:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . This is my code that is causing the above warning: NSMutableArray *tbValueArray = [NSArray arrayWithObjects:oServices1.text, oServices2.text,oServices3.text,oServices4.text,oServices5.text,oServices6.text, oServices7.text,oServices8.text,oServices9.text,oServices10.text,oServices11.text, oServices12.text

how to group array of nsdictionary according to the value inside the element

主宰稳场 提交于 2019-12-13 08:55:42
问题 I have array of dictionary that needs to be grouped according to PO which is part of the element and also get the total of quantityOrdered according to the same PO. The PO is dynamic it means it can be any value that needs to be filtered and compute the quantityOrderd accordingly. Please help. { PO = PO2; QuantityReceived = 1; }, { PO = PO1; QuantityReceived = 3; }, { PO = PO1; QuantityReceived = 3; }, { PO = PO3; QuantityReceived = 2; }, { PO = PO2; QuantityReceived = 2; }, { PO = PO3;

How to sort month name in ascending or descending order using NSSortDescriptor in objective c

邮差的信 提交于 2019-12-13 08:29:41
问题 i need to sort the month and year in ascending or descending order using NSSortDescriptor i have one array { month = Dec; year = 2017; }, { month = Oct; year = 2017; }, { month = Jan; year = 2018; } i used to done this code NSSortDescriptor * sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"year" ascending:YES]; NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor]; yeardata = [NSMutableArray arrayWithArray:[yeardata sortedArrayUsingDescriptors:sortDescriptors]]; for

How to shuffle NSMutableArray without repetition [duplicate]

我是研究僧i 提交于 2019-12-13 08:24:18
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: What’s the Best Way to Shuffle an NSMutableArray? Here in my code I want to shuffle the elements in the array and try to print it out, but it's not shuffling properly, I tried what is shown here.Its working but,it values are repating. for(UIView *view in self.view.subviews) { if([view isKindOfClass:[UIButton class]]) { button= (UIButton *)view; if (button.tag >=1 && button.tag <=20) { for (NSUInteger i = 0; i <