Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using in 5s iOS 7.1 #8

Closed
Kinphi opened this issue Jul 7, 2014 · 6 comments
Closed

Crash when using in 5s iOS 7.1 #8

Kinphi opened this issue Jul 7, 2014 · 6 comments
Labels

Comments

@Kinphi
Copy link

Kinphi commented Jul 7, 2014

crash in
ActionSheetDistancePicker.m

line 120

if ([target respondsToSelector:action])
objc_msgSend(target, action, [NSNumber numberWithInteger:(NSInteger)bigUnits], [NSNumber numberWithInteger:(NSInteger)smallUnits], origin);

@Kinphi
Copy link
Author

Kinphi commented Jul 7, 2014

found the solution:

id (*response)(id, SEL, id, id,id) = (id (*)(id, SEL, id, id,id)) objc_msgSend;
    response(target, action, [NSNumber numberWithInteger:(NSInteger)bigUnits],[NSNumber numberWithInteger:(NSInteger)smallUnits], origin);

@Kinphi Kinphi closed this as completed Jul 7, 2014
@skywinder
Copy link
Owner

Wait, while it not fixed - it's too early to close this issue.
If you found solution, I would be pleased, if you create a pull request.
Can you explain, how to reproduce this crush?
only on 7.1? simulator or device? steps to reproduce?

@skywinder skywinder reopened this Jul 7, 2014
@skywinder skywinder added the bug label Jul 7, 2014
@Kinphi
Copy link
Author

Kinphi commented Jul 7, 2014

i only test in ios 7.1.but serval device,4s,5,5s.only 5s will crash.
simulator i only test in 32bit...for some kind of reason i cant text in 64bit in simulator.
when i use my method to catch the parameter which create by

  • (void)notifyTarget:(id)target didSucceedWithAction:(SEL)action origin:(id)origin
    it carshed.
    the crash point is at

line 120

objc_msgSend(target, action, [NSNumber numberWithInteger:(NSInteger)bigUnits], [NSNumber numberWithInteger:(NSInteger)smallUnits], origin);

when i use

id (response)(id, SEL, id, id,id) = (id ()(id, SEL, id, id,id)) objc_msgSend;
response(target, action, [NSNumber numberWithInteger:(NSInteger)bigUnits],[NSNumber numberWithInteger:(NSInteger)smallUnits], origin);

to replace the old one,it works fine in 5s.

@skywinder
Copy link
Owner

Thanks a lot!
You can find your update in version 1.0.9

BDW, a couple additions to your solution:

void (*response)(id, SEL, id, id,id) = (void (*)(id, SEL, id, id,id)) objc_msgSend;

  1. remove redundant cast
  2. change id to void - otherwise it will be crash on 32-bit devices.

skywinder added a commit that referenced this issue Jul 7, 2014
@skywinder
Copy link
Owner

Fixed in 5a11f0b

@skywinder
Copy link
Owner

Also, ActionSheetDistancePicker still looks not so good on iOS 7 (cm text is misaligned- see TimCinel#108)
I spend a day to just make it works and not crash on iOS 7.
And have no time to align this label.
Sorry for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants