objective c - Stop releasing NSMutableArray in ARC when inserting large data -
In my ARC project, NSMutableArray was automatically released when large data is inserted during XML parsing.
//MainViewController.h: @Portfolio (non-dynamic, strong) NSMutableArray * arrayData; //MainViewController.m: viewWillAppear {self.arrayData = [[NSMutableArray alloc] init]; } -didEndElement {[self.arrayData addObject: @ "SomeData"]; // data successfully inserted NSLog ("Count:% i", [Auto Eradida count]); // calculation is displayed correctly} -numberOfRowsInSection {return [self.arrayData count]; // Return zero! } How can I stop releasing or maintaining it or accepting large data for buffer?
Update: The code data is working is small in NSMutableArray, but if I put large data, then it will be released, so problem in the size of the data!
Define your "head" as a "strong" asset, and The ARC should retain it on the runtime. It will not be released automatically until the property is "weak". It also wants to assign a "copy" attribute:
It is also good practice to start your volatile array with estimated calculation, so the compiler knows that before That you start eating bigger data than XML on runtime:
yourArray = [[NSMUTABARROR] INNTH WITH CASCITY: KYVERBIGNER];
Comments
Post a Comment