nsarray

Downloaded plist (in NSString) convert to NSArray

I am not sure what I am doing wrong here. I have a simple plist on my server. I am using the ASIHTTPRequest framework, so I can get both the data object and a string. Outputting: [[NSString alloc] initWithData:[request responseData] encoding:NSUTF8StringEncoding] works just fine and the output it the plist. However, I cannot get this ...

Extract a range from NSArray

I need to display 6 views and each view should display 20 items (UIButtons). I have one big NSArray which contains the items for all 6 views. For example, view 1 should be items 0-19, view 2 should be items 20-39. How would i extract the relevant range out of the array? Maybe using NSRange with a length of 20, but the start location w...

Unrecognized Selector Sent to Instance [NSCFString subarrayWithRange:]

I have the following code which is producing this error. I cannot understand why the subarrayWithRange message is being sent to a string? When it is clearly an array? static const int kItemsPerView = 20; NSRange rangeForView = NSMakeRange( page * kItemsPerView, kItemsPerView ); NSMutableArray *temp = [[APP_DELEGATE keysArray] mutableCo...

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 NSLog(@"Strings from plist: %@", [[self.aDictionary objectForKey:(@"%@",[self.keys objectAtIndex...

How to keep an array sorted

I'm refactoring a project that involves passing around a lot of arrays. Currently, each method that returns an array sorts it right before returning it. This isn't ideal for a couple reasons -- there's lots of duplicated code, it's inefficient to sort an array two or three times, and it's too easy to write a new function but to forget ...

NSInteger to NSArray iPhone

I have NSInteger variable, for example NSInteger example=1256 and i need an array with elements of this variable. so first element of array is array[0] = 1 array[1] = 2 array[2] = 5 etc.. what way can i solve it ? ...

Modifiying an object outside of a NSArray

In Class Foo I have a retained property of an NSArray which holds UIViews (which have backgroundColor properties) In an instance of class Bar I set the NSArray to an array of views, and then set a views background color: [viewOne setBackgroundColor:[UIColor blueColor]]; NSArray *tempArray = [[NSArray alloc] initWithObjects:viewOne, vie...

Access to NSArray from 3 different instances of class

I have 3 different instances of a class and when a user taps a button (there are buttons for each of the instances) I want it to add the text of the button to the NSArray. But the NSArray must contain all 3 different sets of "historys" Should I be using a singleton, or just keep a reference to the NSArray as a property? ...

Array with a NSDictionary doesn't want to save to the standardUserDefaults

Hello, I am having a... strange problem. I am adding an NSDictionary to an NSArray, then saving it to the defaults. When I check the object count of that key on the user defaults, it says the count is 0, but the array that's "on memory" has that object (so the count is 1). The code, along with the output it gives is this: (array is a...

How to use web request results (xml, plist, etc) as a datasource for UITableView

I want to use coldfusion web query results to populate a UITableView in iOS. The query results come back as a string and I guess I need to convert them to NSArray or NSDictionary... Thanks, Phill ...

how to go from XML to an indexed UITableView

Hi all, I need to parse an XML file so that i can use and indexed UITableView. If I parse the xml, i create an array that holds Companys (for example). I have a class that is the Company, with it's address, etc... How can I go from one array to an array of arrays, with the A, B, C, ...? Do i must create so many arrays has the letters of...

NSArray Memory-Management Issue

Hi folks, Here is my code that is being run in a background thread: -(void)updateFAQCache { NSAutoreleasePool *objPool = [[NSAutoreleasePool alloc] init]; // Grab the new plist NSMutableArray *arrLoadedData = [[NSMutableArray alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://myurl.com/"]]; // If the data is ...

I need to remove double quotes from JSON for use in NSDictionary

I have a JSON return that I'm trying to save into a NSDictionary, However, Since there are spaces in the data being returned, the Dictionary won't save this array because of the quote being included. Is there a way to parse the SBJSON to remove the double quotes prior to saving to the rowsArray? rowsArray: { Rows = ( ...

Where to store a small NSArray of NSDictionaries? Not in my yard!

I have a UITableView with some login form and I manually wrote the configuration values of the UITextFields in this NSArray as NSDictionaries. It is bothering because it's data in the code. I don't want data in my code! And I think that nobody wants that. Have you ever been in this situation? How would you dispose properly of this data?...

NSArray Memory Leak!! Not able to get Why??

Hi I am getting memory leak in Instruments for the following line of code . NSArray *itemsList=[[NSArray alloc] initWithObjects:@"Love", @"Hate",@"Happy",@"Sad", @"Desire",@"Anger",@"Hope",@"Fear",@"Silly",nil]; I am using the below code: arrayList is also released in dealloc block. NSArray *itemsList=[[NSArray alloc] init...

How To remove an item from Login Items using shell script

Hi, In Mac, I want to remove an application from the login items using Shell script. I tried following code, but didn't work.. defaults write loginwindow AutoLaunchedApplicationDictionary -array-remove path "/Applications/myApp.app" But it is giving error "Unexpected argument -path; leaving defaults unchanged" Regards, Dhanara...

Sorting an NSArray of NSDictionary

I have to sort an array of dictionaries but I have to order by an object in the dictionaries. ...

ReCall NSArray in RootViewController

I use original method XML data can show in rootviewcontroller TableView. When i use New Procedure it show the table only no data. How can i show the data in New Method? Original Method appDelegate.m (setup XML & load the data) rootviewController.m (use nsarray & load the data into table view) New Method appDelegate.m (setup XML &...

Problem with singleton from xml parser. afternavigation.

after parse xml. xml attributes data i stored in NSMutableArray *anArray; which is in MyAppDelegate. I used anArray in MyAppDelegate. For my xml i do have One root Tag and N number Child tag. my xml example: <root> <child name1="",name2="",name3=""/> <child name1="",name2="",name3=""/> <child name1="",name2="",name3="...

[LeavesView Class] NSArray leaking with alot of images

I am using the LeavesView Class available on GitHub by Tom Brow. On the iPad, I have 23 images at 1024x768 ranging from 200-500KB (JPG's). I have compressed the images as much as I could without losing quality. For some reason, when I init with the list of images, the memory drops significantly, and ultimately crashes. Here's some code...