automatic-ref-counting

iOS: Block property directly set crashes when accessed

前提是你 提交于 2019-12-05 02:39:25
Consider the following code: @interface ClassA : NSObject @property (nonatomic, copy) void(^blockCopy)(); @end @implementation ClassA @synthesize blockCopy; - (void)giveBlock:(void(^)())inBlock { blockCopy = inBlock; } @end Then use it in a class which has a strong property of type ClassA called someA : self.someA = [[ClassA alloc] init]; [self.someA giveBlock:^{ NSLog(@"self = %@", self); }]; dispatch_async(dispatch_get_main_queue(), ^{ self.someA.blockCopy(); self.someA = nil; }); If I run that built O3 with ARC enabled, on iOS, it crashes during the self.someA.blockCopy(); call inside objc

How to require ARC in a class?

吃可爱长大的小学妹 提交于 2019-12-05 02:37:46
I have an app with both ARC code and non-ARC code. The compiler will catch when I try to compile non-ARC code as ARC. How do I cause a compile time error/notice when my ARC code is erroneously compiled without ARC? Obviously, the code will compile. It will just leak. The static analyzer will catch the problem. I would rather find a way to leave a pragma or define in my ARC code. The following is defined by Apple in objc-api.h : /* OBJC_ARC_UNAVAILABLE: unavailable with -fobjc-arc */ #if !defined(OBJC_ARC_UNAVAILABLE) # if __has_feature(objc_arr) # define OBJC_ARC_UNAVAILABLE __attribute__(

ObjC ARC contraction (clang crash)

可紊 提交于 2019-12-05 02:28:21
I always hesitate to add a brand new question to the killer forums here, but I haven't seen anything close to this bug. Seems clang has crashed on my while compiling one of my .m files. If anyone has seen or knows of any solution for the below I'd be immensely obliged. This error occurs when I build for armv6 in a release configuration using XCode 4.4.1 But does not occur when I build for armv6 in a debug configuration , or release for armv7, armv7s or i386. The specific error is "ObjC ARC contraction": 1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager'

How do I draw a partial bitmap-arc? Like a circular progress wheel, but with a bitmap that gets more and more displayed.

二次信任 提交于 2019-12-05 02:08:53
问题 What I am searching for, is a view that reveals an image in a clockwise circular fashion. When the progress is 25% the first 90 degrees should be revealed and when its 100% the full 360 degrees should be drawn. It is very close to using the canvas.drawArc(), but this method only works with Paint objects, not bitmaps. Other answers also only work with full colors: How To Make Circle Custom Progress Bar in Android I have found it to be a very hard problem, I hope someone has a solution. 回答1:

Mac App Store: Giving up 32 bit support in favor for ARC, will existing users of 32 bit version see an update message?

左心房为你撑大大i 提交于 2019-12-05 02:01:44
问题 I'm considering dropping 32-bit support for in favor for Automatic Reference Counting (which is only supported for 64 bit binaries). I'd like to avoid these two scenarios with the Mac App Store: For a user of an old 32-bit Mac : who did purchase the previous version with 32-bit support: Will they see an update message for the app in the Mac App Store? If so, the (now 64 bit only) update would not work for him/her. who has not purchased the app before: will they be able to purchase the app

-fno-objc-arc not working to disable ARC

非 Y 不嫁゛ 提交于 2019-12-05 01:42:00
I have tried the solution found in this post to disable ARC in AFNetworking files, but to no avail: Any ideas where I am failing? Obviously the simpler the answer the better. I have also read that creating static libraries may help, but this seems complicated. EDITS I have tried deleting derived data and Clean and Build and restarting Xcode. No deals :(. Also, there are no other projects in my workspace. Weird thing. I tried adding the -fno-objc-arc flag to some Facebook files and the project finally built. I guess the lesson here is that when Xcode generates these types of errors, the source

How to find the real cause of memory warning and how to resolve in iOS app

两盒软妹~` 提交于 2019-12-05 01:13:01
I have go through many posts related memory management, ARC , memory management techniques like autoreleasepool and using instruments tool to detect which code is causing memory warning but in my case I am not able to figure out the exact cause. Basic details which you must know about the app: We have developed an iPad app. In that we have to use more then 2000 images in some case, so when my app launch we do not want to show them placeholder image (client requirement).so to achieve this, we used SDWebImage , store images on disk and later than we are loading images from there. There are so

How to resolve “no known instance method for selector 'performSelector:withObject:afterDelay:'” when migrating to ARC?

痞子三分冷 提交于 2019-12-05 01:03:53
The ARC migration tool is refusing to accept this code prior to starting with migration: [self.delegate performSelector:@selector(overlayDismissed:) withObject:self afterDelay:0]; The delegate is forced to implement this method with a protocol, and it should work fine: @protocol OverlayDelegate <NSObject> - (void)overlayDismissed:(Overlay*)overlay; @end @interface Overlay : UIImageView { id<OverlayDelegate> delegate; } @property (nonatomic, assign) id<OverlayDelegate> delegate; What's wrong with ARC? Why is it telling me that there is "no known instance method for selector 'performSelector

EXC_BAD_ACCESS (SIGSEGV)

本秂侑毒 提交于 2019-12-05 00:52:52
I got this crash report from a remote user, but I cannot find any useful tip to resolve this issue, may be it's a retain problem but I cannot understand why because of I'm using ARC. Very small number of users are issuing this problem. I've tried all things both on simulator and on device (iPhone 4s) without any crash occurs... If I was able to crash on my device it will be very simple to find out what the problem is. Somebody knows how to fix this issue? Incident Identifier: F30F9C75-0FE3-4B39-AA17-209690A4787D Hardware Model: iPod4,1 Process: Body-Language [1220] Path: /var/mobile

NSPointerArray weird compaction

て烟熏妆下的殇ゞ 提交于 2019-12-05 00:37:26
I have a weak NSPointerArray with some NSObject that has been released. Before calling compact what I see is: (lldb) po [currentArray count] 1 (lldb) po [currentArray pointerAtIndex:0] <nil> (lldb) po [currentArray allObjects] <__NSArrayM 0x16f04f00>( ) That makes sense, but what is really weird is that when I call compact on that array I see the same values! Count still returns 1 and pointerAtIndex:0 is nil . Why the nil hasn't been removed? EDIT Here's the full code (yeah it's XCTesting framework): - (void)testCompaction { __weak id testingPointer = nil; NSPointerArray *weakArray =