I have the following code that does not work on the 64-bit iOS simulator. This EXC_BAD_ACCESS
with the following line
But this code to 32-bit and 64 Works - even on the iPhone and iPad devices and even 32-bit simulators.
code I have shown so far that <> char * cast may be the source of error 64-bit except the iOS Simulator va_list
to four *
looks like
How do I avoid this error? Can devices have problems?
+ (NSIvvocation *) invocationWithTarget: (id) target selector (SEL) Arguments for maintaining Arguments: (BOOL) to maintain a selector, ...; {Va_list AP; Va_start (AP, retired agreements); Char * args = (four *) AP; NSMethodSignature * Signature = [Goal Method: Signature Folder Checker: A Selector]; NSIVWocation * Invocation = [NSINN Encountational With-Law Method: Signature]; If (Arguments to Maintain) {[Arguments to keep on invitation]; } [Invitation set target: goal]; [Invite set selector: a selector]; (Int index = 2; Index & lt; [sign Snkyaoafaarguments]; Index ++) (Const get char * type = [Signature Astrogjtapatindaks: index]; NSUInteger size, align, NSGetSizeAndAnignment (type, size, and align ;); NSUInteger mod = (NSUInteger) args% align; if (mod! = 0) {Args + = (align-mod);} [invention setarmament: args on index: index]; arg = size;) Va_end (AP); back inserts;}
I think the problem comes on args + = (align - mod));
, how va_arg
is not known, it may be different between the two versions of the compiler I own va_arg
to args
I recommend you use instead of moving.
In this way, you have to use objective-object in the form of parameters, because we have one of them being considered id
.
+ (NSIvvocation *) invocationWithTarget: (id) target selector (SEL) Arguments for maintaining a selector: (BOOL) Arguments for maintaining ,. .. {va_list ap; Va_start (AP, retired agreements); NSMethodSignature * Signature = [Goal Method: Signature Folder Checker: A Selector]; NSIVWocation * Invocation = [NSINN Encountational With-Law Method: Signature]; If (Arguments to Maintain) {[Arguments to keep on invitation]; } [Invitation set target: goal]; [Invite set selector: a selector]; (Int index = 2; index and lieutenant; [sign number of alpha]; index ++) {id logic = va_arag (ap, id); [Invitation setAgency: & amp; Index on pair: index]; } Va_end (AP); Back inserts; }
I believe we can improve the use of const char * type = [signature getArgumentTypeAtIndex: index];
and some method can be used to decode that method, passed va_arg
, but I could not find any solution to get it.
No comments:
Post a Comment