objective c - Array copying crashes app -


<पूर्व> NSArray * mruSearchItems; NSMutableArray * mruItems; Self.mruItems = [[NSMutableArray alloc] initWithArray: [[NSUserDefaults मानक उपयोगकर्ता डीफॉल्ट] arrayForKey: @ "खोजों"]]; । । इस बिंदु पर mruItems खाली हो जाता है । । Self.mruSearchItems = [[NSArray alloc] initWithArray: self.mruItems];

अंतिम पंक्ति एक दुर्घटना का कारण बनती है।

  EXC_BAD_ACCESS   

ऐसा क्यों है?

डॉट नोटेशन सिंटैक्स ( self.mruSearchItems ) का उपयोग करने में सक्षम होने के लिए आपको < कोड।> mruSearchItems;

अगर आपके पास पहले से कोई संपत्ति है (और इसे यहां नहीं दिखाया है) सुनिश्चित करें कि यह मजबूत है (नहीं कमजोर ) अन्यथा आपके arrays को रिहा किया जाएगा।

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -