![]() Id * fakeArgList = (_bridge id *)malloc(sizeof(NSString *) * ) The problem here is that you're casting from C-pointers to Objective-C pointers, which you cannot do without bridging: NSMutableArray * argumentsArray = Looking at this code, it seems like a pretty dirty hack, but I suppose if it worked without ARC, it should also work with ARC. NSString * content = initWithFormat:formatStringĪrguments:(_bridge va_list)fakeArgList] Id* fakeArgList = (_bridge id *)malloc(sizeof(NSString *) * ) While((nextArgument = va_arg(argumentsList, NSString*))) plist file with fields "field1" = "foo" and "field2" = 3 and I call [loadStringFromFixture: then I should get string "?param1=foo¶m2=3" - (NSString*) loadStringFromFixture:(NSString*) format. plist and output a formatted string with data loaded from. It should take a printf-style format string and a variable list of field names inside the. My initial theory was that I just need to add _unsafe_unretained to (id*) casting to tell ARC that I'm responsible for that block of memory and it shouldn't retain/release it, but that doesn't work and I can't figure out how to fix this problem. ![]() XCode complains on the (id) fakeArgList* casting, saying:Ĭast of non-Objective-C pointer type 'char *' to '_autoreleasing id *' NSString* content = initWithFormat: formatString arguments:fakeArgList] And then, I want to construct a "fake" variable argument listĬhar* fakeArgList = (char*) malloc( sizeof(NSString*) * ) Here I fill argumentsArray with some elements Here's the code in question: NSMutableArray* argumentsArray = I'm trying to construct "fake" variable arguments list, using the technique described here, but for ARC-enabled project and I can't figure out how to get rid of the error I'm getting. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |