Closed Bhide closed 4 years ago
I notice in ActionSheetCustomPicker.h file, the delegate is strong. @property(nonatomic, strong) id <ActionSheetCustomPickerDelegate> delegate;
So this property was holding a strong reference to the view controller, which prevented it from ever being deallocated. If you are using ActionSheetCustomPicker class, changing the delegate to weak might solve the problem.
@adamhongmy Do you mean modify the source code directly?
@MyNameIsWood Yup. diy or wait for the owner to do so. Btw, if only you use ActionSheetCustomPicker class, then it worth a shot to try it by changing @property(nonatomic, strong) id <ActionSheetCustomPickerDelegate> delegate;
to @property(nonatomic, weak) id <ActionSheetCustomPickerDelegate> delegate;
@adamhongmy I already do so. Will it cause any other bugs?
@MyNameIsWood Not really. Btw are u calling ActionSheetCustomPicker class?
For me it doesn't affect me whether I change it or not because i'm not using it.
already fixed, thanks for investigation, @adamhongmy 👍
`dateSelector = ActionSheetDatePicker.init(title: "", datePickerMode: .date, selectedDate: Date(), doneBlock: { [unowned self](datePicker, date, index) in debugPrint("selected date: ((date as! NSDate).formatDateTime())")
I ran instruments to check the leaks and found 53 leaks when I dismissed my UIViewController without pressing the
ActionSheetDatePicker
's Cancel or Done. In this case, the presented UIViewController is not deallocated.