automatic-ref-counting

UIPopoverController dealloc getting called—ARC environment

浪尽此生 提交于 2019-12-09 08:21:50
问题 While displaying a popover controller for a second time (after dismissing it and then re-displaying it), I get the following error: Terminating app due to uncaught exception 'NSGenericException', reason: '-[UIPopoverController dealloc] reached while popover is still visible.' The stack trace is only a bunch of hex and the SIGABRT happens at UIApplicationMain every time. Here's the code that the button triggers: - (IBAction)createNewScore:(id)sender { if (self.pc) if (self.pc.popoverVisible)

App converted to ARC, now getting warnings about my properties

坚强是说给别人听的谎言 提交于 2019-12-09 08:12:15
问题 I just converted my app to ARC , and while it builds fine, I get like 600 warnings, all pertaining to my properties. Such as: Default property attribute 'assign' not appropriate for non-gc object No 'assign', 'retain' or 'copy' attribute is specified - 'assign' is assumed After Xcode converted my code, here is what my properties look like: @property (nonatomic) EKEventStore *eventStore; @property (nonatomic) EKCalendar *defaultCalendar; @property (nonatomic) UIActionSheet *currentActionSheet;

Simple rules for naming methods, compatible with ARC naming conventions

余生长醉 提交于 2019-12-09 07:20:00
问题 I have difficulties understanding naming conventions of ARC. I have always coded with ARC, and I guess this is the reason. 1. Class methods What name should I choose for the following method? What are the differences, concerning memory management, between theses two names? This name: + (MyObject *)newObjectFrom:(MyObject *)anObject withOptions:(NSDictionary*)options { MyObject * newObject = [anObject copy] ; [newObject modifyWith:options] ; return newObject ; } or this name ? + (MyObject *

Cocos2D project with many scenes does not release memory properly

岁酱吖の 提交于 2019-12-09 04:55:10
问题 I've got a great problem and I don't understand very well why occurs. This is the case: Have a great project in Cocos2D with 10 scenes. Each scenes is a page of a book with huge sprites. It uses Kobold2D 1.0.2 implementation. Every page has common objects in a singleton class, to put a common menus via LayerColor. The sprites is TexturePacker in PVR.CCZ RGBA4444 and in iPad memory are around 16-20Mb every spritesheet loaded. I use CCTransitionTurnPage for replaceScene for one to the next one.

Having a zombie issue on UISearchDisplayController

做~自己de王妃 提交于 2019-12-08 19:45:48
问题 I am having a zombie while using a UISearchDisplayController with a UITableView. The UISearchDisplayController (and the rest of the view) is set via interface builder (storyboard on xcode 5 and using ARC and iOS 7 only). The searchDisplayController is used by these 2 methods -(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { [self filterContentForSearchText:searchString scope: [[self.searchDisplayController

How do you handle 'require( …, bail)' statements with ARC?

帅比萌擦擦* 提交于 2019-12-08 19:20:49
问题 I'm looking through some of the sample code for the Square Cam in Apple's sample code. I want to replicate some of it's functionality in a modern project using ARC. However, there are a ton of require statements such as: BOOL success = (destination != NULL); require(success, bail); Which generates the compiler error: Goto into protected scope. My question is -- what is the appropriate way to handle such statements in a project using ARC? 回答1: I had the same problem (with the same sample code)

Deploying to OS X 10.6 and “-fobj-arc is not supported on platforms using the legacy runtime”

时光毁灭记忆、已成空白 提交于 2019-12-08 16:16:41
问题 Background: I'm building an app for OS X with deployment target of 10.6. I have not converted my app to ARC completely, but I am adding a few new classes which would benefit from ARC, so I have set the -fobj-arc compiler flag for those classes. Compiling fails for Universal 32/64-bit Intel architecture, with error -fobj-arc is not supported on platforms using the legacy runtime . Building for 64-bit only succeeds. I'm not well versed in low level architecture. My question is: what is the

Why does this simple NSWindow creation code trigger an autorelease pool crash on shutdown under ARC?

回眸只為那壹抹淺笑 提交于 2019-12-08 15:41:28
问题 I am having an issue with an autorelease pool crash on shutdown which I've reduced to the small test case below that simply creates a window and then closes it. The crash disappears if the -fobjc-arc flag is taken away. Running on OS X 10.8.2, Clang 4.1 (421.11.66). I am hoping that someone with a more in depth understanding of ARC can enlighten me as to what is going on here - running with zombie objects on shows that it is the NSWindow object that is getting released too many times, or not

Automatic Reference Counting: Error with fast enumeration

旧巷老猫 提交于 2019-12-08 14:58:18
问题 While updating the code below to use Automatic Reference Counting for iOS 5, an error is occurring when the "state->itemPtr" is assigned the buffer when trying to perform Fast Enumeration so that the implementing class can be iterated with the "foreach" loop. The error I am getting is "Assigning '__autoreleasing id *' to '__unsafe_unretained id*' changes retain/release properties of pointer". See the line of code with the comment. /* * @see http://cocoawithlove.com/2008/05/implementing

Why Obj-C instance have 1 retain count Just created?

别来无恙 提交于 2019-12-08 13:24:51
问题 I studying obj-c/swift arc system. print log on retain count of created instance by CFGetRetainCount func. I expected reference count like these let foo1 = NSObject() // foo1 retain count 1 let foo2 = foo1 // foo1 retain count 2 foo2 = nil // foo1 retains count 1 foo1 = nil // foo1 retain count 0. release but actually.. let foo1 = NSObject() // foo1 retain count 2 let foo2 = foo1 // foo1 retain count 3 foo2 = nil // foo1 retain count 2 foo1 = nil // foo1 retain count 1. release and print