fermoya / SwiftUIPager

Native Pager in SwiftUI
MIT License
1.3k stars 172 forks source link

[BUG] Crash when running on a iOS 13.1 Simulator #194

Closed raffaeleforgione closed 3 years ago

raffaeleforgione commented 3 years ago

Describe the bug When Running on iOS 13.1 Simulator, the app crashes becaus of the following: dyld: Symbol not found: _$s7SwiftUI18AnimatableModifierPAAE13_makeViewList8modifier6inputs4bodyAA01_fG7OutputsVAA11_GraphValueVyxG_AA01_fG6InputsVAiA01_L0V_ANtctFZ Referenced from: /Users/***/Library/Developer/CoreSimulator/Devices/3BA98118-7FC5-46DA-A006-EEF202D25F2A/data/Containers/Bundle/Application/6A1A3C95-9D7C-43BD-BC81-0011FAD872F6/Spaccio Vino.app/Frameworks/SwiftUIPager.framework/SwiftUIPager Expected in: /System/Library/Frameworks/SwiftUI.framework/SwiftUI

To Reproduce SwiftUIPager 2.0.2 Run on iOS 13.1 Simulator the following: Pager(page: page, data: pageData) { item in NewHomeBanner(text: item.text) }.onPageChanged { page in displayedPage = page }

Expected behavior App not crashing

Environment:

fermoya commented 3 years ago

@raffaeleforgione have you tried running in a real device with iOS 13.1 installed? The error says that AnimatableModifier couldn't be found. If you see its declaration:

/// A modifier that can create another modifier with animation.
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
  public protocol AnimatableModifier : Animatable, ViewModifier {
}

That protocol should be available in iOS 13+. I've actually run the Sample project in iOS 13.1 and iOS 13.2. iOS 13.1 crashes, iOS 13.2 runs with no issue. See "Dancing With Versions" here: https://swiftui-lab.com/swiftui-animations-part3/

It might just be an issue with those simulators. Please let me know if the issue is also reproduced in a real device

fermoya commented 3 years ago

2.1.0 should fix this issue, although as I mentioned this seems to be an Xcode issue.

MartinMetselaar commented 3 years ago

This is still happening for me with 2.2.0 on iOS 13.1 and iOS 13.0

dyld: lazy symbol binding failed: Symbol not found: _$s7SwiftUI18AnimatableModifierPAAE13_makeViewList8modifier6inputs4bodyAA01_fG7OutputsVAA11_GraphValueVyxG_AA01_fG6InputsVAiA01_L0V_ANtctFZ
  Referenced from: ..../RPXSwiftUI.framework/RPXSwiftUI
  Expected in: /System/Library/Frameworks/SwiftUI.framework/SwiftUI
fermoya commented 3 years ago

Hi @MartinMetselaar, does this happen when you run the App or when Pager appears? I remember including this and this that solved this issue back then.

Could you debug and let me know please?

As I mentioned above, that error is an issue on Apple's side (the class is available in iOS 13.0) and I suspect it only happens on simulators but I couldn’t be sure

MartinMetselaar commented 3 years ago

It happens when the Pager appears and I think it is because AnimatableModifier is still used in OnAnimationCompletedModifier.swift which is available at iOS 13.

I have downgraded the library back to 1.14.2 and submitted it to Apple for Review. When it will start releasing I can give you a definitive answer if it solved the crash.

fermoya commented 3 years ago

Hi @MartinMetselaar , have you tried forking the repo and changing this line to:

@available(iOS 13.2, macOS 10.15, tvOS 13.0, watchOS 6.0, *)

? I haven’t tried it yet (I will as soon as I find some time) but i think that should work

MartinMetselaar commented 3 years ago

Yes, I have. But that resulted also in changing the extension to 13.2. But since the function onAnimationCompleted from the extension is used in PagerContent also that file needed to be changed to 13.2. Which basically makes the minimum iOS version for this framework 13.2.

fermoyadrop commented 3 years ago

@MartinMetselaar apologies, the change in not so direct. Can you try this branch and let me know? I've changed availability of onAnimationCompleted.

MartinMetselaar commented 3 years ago

EDIT: This comment is incorrect.

Your branch is not working because of the following change in OnAnimationCompletedModifier.swift

- @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
+ @available(iOS 13.2, macOS 10.15, tvOS 13.0, watchOS 6.0, *)

If I revert those two lines it is working. Please also verify it yourself.

fermoya commented 3 years ago

What do you mean it’s not working? It’s not compiling? It should work because there’s this check.

it compiles for me at least, Xcode 12.5

MartinMetselaar commented 3 years ago

You are right. I don't know where I made the mistake. Your branch (fix/ios13-symbol-not-found) is working for me now.

fermoya commented 3 years ago

@MartinMetselaar glad to hear that. Does that mean it doesn’t crash anymore? If so, I’ll push a release ASAP

MartinMetselaar commented 3 years ago

It indeed does not crash anymore in the iOS 13 and 13.1 simulator. You don't need to rush the release for me. And, thank you for fixing it!

Were you able to reproduce the issue?