yonat / MultiSlider

UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.
MIT License
494 stars 113 forks source link

Crashing on iOS 14.6+ - Symbol not found #86

Closed tylerjames closed 2 years ago

tylerjames commented 2 years ago

Strangely getting a crash now when run on iOS 14.6+ but not iOS 15. App crashes right at startup with this message. Strangely had this in the app for a while and it only started causing a problem recently. Built on an M1 Pro. Not sure if that makes a difference

dyld: Symbol not found: _$sSo22NSManagedObjectContextC8CoreDataE5fetchySayypGSo14NSFetchRequestCySo0gH6Result_pGKF Referenced from: /private/var/containers/Bundle/Application/8201E96C-E94C-4495-9983-AFDB219DB2E7/MyApp.app/Frameworks/SweeterSwift.framework/SweeterSwift Expected in: /usr/lib/swift/libswiftCoreData.dylib

dyld: launch, loading dependent libraries DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

yonat commented 2 years ago

Wow, this is a tough one! Would you create a minimal project that reproduces this problem so I can check it? (See https://ootips.org/yonat/repex/)

tylerjames commented 2 years ago

If I can get to around it.

It comes from the SweeterSwift library. But Multislider only uses extensions from UIView+Sweeter. It's the NSManagedContext one that seems to be causing a problem.

It's very strange because I've had this library in use for months and I'm sure it's run on iOS 14 before. I recently got an M1 Pro so I don't know if it's just building it differently. There's no compiler error associated with it. It's just a runtime crash due to the code merely existing (it's never called by Multislider)

I made a fork that just removes the SweeterSwift dependency and copies over the UIView+SweeterSwift extension and that was enough to get it working.

tylerjames commented 2 years ago

Okay I found the issue. In your NSManagedObjectContext.printAllObjects() function on this line: guard let objects = try? fetch(NSFetchRequest(entityName: entityName)) else { continue }

Change it to this: guard let objects = try? fetch(NSFetchRequest<NSFetchRequestResult>(entityName: entityName)) else { continue }

I don't know why it causes a crash on iOS 14 just by existing in the first form but adding the generic fixes it.

yonat commented 2 years ago

Thanks! I wasn't able to reproduce the crash, but the change you suggest doesn't cause any problems so I add it to SweeterSwift 1.2.1 .