ObjectAL-for-iPhone icon indicating copy to clipboard operation
ObjectAL-for-iPhone copied to clipboard

updating to iOS 8

Open brendancmiller opened this issue 10 years ago • 3 comments

upgrading my app to iOS 8. Getting the following error when building for the first time

OALSuspendHandler.m "Too many arguments to function call, expected 0, have 3" objc_msgSend

brendancmiller avatar Oct 05 '14 19:10 brendancmiller

try this:

void (*my_objc_msgSend)(id, SEL, bool) = (void (*)(id, SEL, bool)) objc_msgSend;
my_objc_msgSend(suspendStatusChangeTarget, suspendStatusChangeSelector, manualSuspendLock);

Prometei7 avatar Oct 10 '14 14:10 Prometei7

I got EXC_BAD_ACCESS from that fix when the method is invoked. Following this advice from StackOverflow (http://stackoverflow.com/questions/2650190/objective-c-and-use-of-sel-imp) seems to have fixed it:

    // Old code
    //id (*typed_msgSend)(id, SEL, bool) = (id (*)(id, SEL, bool))objc_msgSend;
    //typed_msgSend(suspendStatusChangeTarget, suspendStatusChangeSelector, manualSuspendLock);
    // New code
    if([suspendStatusChangeTarget respondsToSelector:suspendStatusChangeSelector])
    {
        id (*method)(id, SEL, bool)  = (id (*)(id, SEL, bool))[suspendStatusChangeTarget methodForSelector:suspendStatusChangeSelector];
        method(suspendStatusChangeTarget, suspendStatusChangeSelector, manualSuspendLock);
    }

croesus avatar Nov 27 '14 11:11 croesus

PS made a fork/pull req with this fix

croesus avatar Nov 27 '14 14:11 croesus