Rxswift: Crash on runtime if SPM is used

Created on 27 Oct 2019  路  12Comments  路  Source: ReactiveX/RxSwift

If I use SPM for Rx* it fails to create ReplaySubject on runtime with EXC_BAD_ACCESS. It does work if I use CocoPods

import UIKit
import RxSwift

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    private let modelSubject = ReplaySubject<Bool>.create(bufferSize: 1)

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        return true
    }

}

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

RxSwift 5.0.1

Platform/Environment

  • [x] iOS
  • [ ] macOS
  • [ ] tvOS
  • [ ] watchOS
  • [ ] playgrounds

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

  • [x] easy, 100% repro

Xcode version:

11.2 beta (11B41)

Installation method:

  • [x] SPM
  • [ ] CocoaPods
  • [ ] Carthage
  • [ ] Git submodules

I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)

  • [ ] yes (which ones)
  • [x] no

Screenshot 2019-10-27 at 09 03 08

Screenshot 2019-10-27 at 09 03 00

Screenshot 2019-10-27 at 09 04 10

Most helpful comment

Setting DEAD_CODE_STRIPPING=No in your Xcode build settings should workaround this for now. (Probably best to remember to switch it back on again once SR-11564 is fixed.)

https://bugs.swift.org/browse/SR-11564?focusedCommentId=51285&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-51285

All 12 comments

I have same problem...

Same problem with the official Xcode 11.2 (11B52)

Same thing here with Xcode 11.2 (11B52). I've downgraded to Xcode 11.1 and it works.
I hope Apple fix this huge problem.

This is caused by SR-11564. (https://bugs.swift.org/browse/SR-11564)

This is absolutely wild. I can't believe Apple shipped Xcode with a bug this bad.

Meh. I'm not sure if there's any point in keeping this open as it's not an issue with RxSwift itself as a library. Thoughts?

@freak4pc personally, I鈥檇 leave it open to prevent too many dupes. Anyone using SPM will be hitting this and likely checking the issues page here.

@freak4pc I see where you're coming from, but at least in my case RxSwift was crashing "first" (bad access on ReplaySubject.create) so I came here. This issue was at least useful to me to link me in to the broader issue in SR-11564 so it might help others.

They would still find this issue in search, but sure, let's leave it open for a couple more days.

Yeah this is 5 alarm fire bad, I agree with leaving it up for a few days. I'm sure someone's having a lovely Friday in Cupertino right about now. 馃檭

Setting DEAD_CODE_STRIPPING=No in your Xcode build settings should workaround this for now. (Probably best to remember to switch it back on again once SR-11564 is fixed.)

https://bugs.swift.org/browse/SR-11564?focusedCommentId=51285&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-51285

Closing. Thanks for the investigation and workaround, @tcldr !

(P.S. this should be fixed in 11.3)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lyricsboy picture lyricsboy  路  3Comments

jaumard picture jaumard  路  3Comments

angerman picture angerman  路  3Comments

RobinFalko picture RobinFalko  路  3Comments

RafaelPlantard picture RafaelPlantard  路  3Comments