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

Fix Swift Bug RE self.initialSelection in multi-pickers #252

Merged
merged 4 commits into from
Feb 8, 2016

Conversation

sschale
Copy link

@sschale sschale commented Feb 4, 2016

Affected file: ActionSheetMultipleStringPicker.m
Affected variable: self.initialSelection - marked as (nonatomic, assign) NSArray *

Issue: In a Swift project, when I create an instance with:
let multiPicker = ActionSheetMultipleStringPicker(title: "", rows: [["Test"], ["Test"]], initialSelection: [0,0], doneBlock: nil, cancelBlock: nil, origin: self)

The result is a crash with message EXC_BAD_ACCESS when ActionSheetMultipleStringPicker.m attempts to access self.initialSelection and enumerate through it.

Resolution: Change assign -> strong for self.initialSelection

This resolves the issue.

With Swift, having self.initialSelection as (nonatomic, assign) resulted in EXC_BAD_ACCESS when initializing the picker and attempting to access the property. Changing to (nonatomic, strong) fixed the error.
Same issue as in MultiPicker
@skywinder
Copy link
Owner

OMG, what a shame bug!
Thank you very much, @sschale!

skywinder added a commit that referenced this pull request Feb 8, 2016
Fix Swift Bug RE self.initialSelection in multi-pickers
@skywinder skywinder merged commit 013151f into skywinder:master Feb 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants