Beginning RxSwift - Part 5: Subscribing to | Ray Wenderlich Videos

Learn how to subscribe to an observable, and how to manage memory by using dispose bags.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4743-beginning-rxswift/lessons/5

Hi there,

I’m getting this error:

"Playground execution failed:

error: Couldn’t lookup symbols:
…"

I’ve tried all the debug tips but is still happening…
I’d like to know if the entire tutorial will be using playground in a project.

Thanks!

Hi, please make sure you have the iPhone simulator selected for your active scheme, i.e., instead of an actual device.

I’m having the same problem:

  • macOS High Sierra version 10.13.4
  • Xcode Version 9.3 (9E145)

My Podfile looks like this:

platform :ios, '11.0'
use_frameworks!

target 'RxSwiftPlayground' do
  pod 'RxSwift', '~> 4.0'
end

That installed RxSwift 4.1.2:

cat Podfile.lock
PODS:
  - RxSwift (4.1.2)

DEPENDENCIES:
  - RxSwift (~> 4.0)

SPEC REPOS:
  https://github.com/CocoaPods/Specs.git:
    - RxSwift

SPEC CHECKSUMS:
  RxSwift: e49536837d9901277638493ea537394d4b55f570

PODFILE CHECKSUM: e7b74006b089682274066aa281a321a95a91c8e4

COCOAPODS: 1.5.0

I did the debug steps from the Installing RxSwift video, including cleaning the derived build folder.
The project builds and I can run it in the simulator, but The playground throws errors like this:

Playground execution failed:

error: Couldn't lookup symbols:
  __T07RxSwift5EventOMa
  __T07RxSwift12ObserverTypePAAE6onNexty1EQzF
  __T07RxSwift14ObservableTypePAAE9subscribeAA10Disposable_py1EQzcSg6onNext_ys5Error_pcSg0gI0yycSg0G9CompletedAM0G8DisposedtF
  __T07RxSwift17PrimitiveSequenceVyxq_GAA0cD4TypeAAWa
  __T07RxSwift14ObservableTypePAAE9subscribeAA10Disposable_pyAA5EventOy1EQzGcF
  __T07RxSwift10ObservableCyxGAA0C4TypeAAWa
  __T07RxSwift10DisposeBagCMa
  __T07RxSwift10ObservableCMa
  __T07RxSwift10DisposablePAAE8disposedyAA10DisposeBagC2by_tF
  __T07RxSwift17PrimitiveSequenceVMa
  __T07RxSwift10DisposableMp
  __T07RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0gE0RtzrlE9subscribeAA10Disposable_pyAA0F5EventOy07ElementE0QzGcF
  __T07RxSwift11AnyObserverVyxGAA0D4TypeAAWa
  __T07RxSwift14ObservableTypePAAE9subscribeAA10Disposable_py1EQzcSg6onNext_ys5Error_pcSg0gI0yycSg0G9CompletedAM0G8DisposedtFfA0_
  __T07RxSwift14ObservableTypePAAE2ofAA0C0Cy1EQzGAHd_AA018ImmediateSchedulerD0_p9schedulertFZ
  __T07RxSwift14ObservableTypePAAE6createAA0C0Cy1EQzGAA10Disposable_pAA11AnyObserverVyAHGcFZ
  __T07RxSwift11SingleTraitON
  __T07RxSwift12ObserverTypePAAE7onErrorys0F0_pF
  __T07RxSwift10DisposeBagCACycfC
  __T07RxSwift14ObservableTypePAAE9subscribeAA10Disposable_py1EQzcSg6onNext_ys5Error_pcSg0gI0yycSg0G9CompletedAM0G8DisposedtFfA1_
  __T07RxSwift21PrimitiveSequenceTypePA2A11SingleTraitO0gE0RtzrlE6createAA0cD0VyAE07ElementE0QzGAA10Disposable_pyAA0F5EventOyALGcc9subscribe_tFZ
  __T07RxSwift11AnyObserverVMa
  __T07RxSwift14ObservableTypePAAE5neverAA0C0Cy1EQzGyFZ
  __T07RxSwift14ObservableTypePAAE5emptyAA0C0Cy1EQzGyFZ
  __T07RxSwift14ObservableTypePAAE9subscribeAA10Disposable_py1EQzcSg6onNext_ys5Error_pcSg0gI0yycSg0G9CompletedAM0G8DisposedtFfA2_
  __T07RxSwift11DisposablesV6createAA10Disposable_pyFZ
  __T07RxSwift14ObservableTypePAAE2ofAA0C0Cy1EQzGAHd_AA018ImmediateSchedulerD0_p9schedulertFZfA0_

Maybe we need to peg to a specific older version of RxSwift? Scott, what version of RxSwift is listed in your Podfile.lock?

Thanks
Mark

I’m seeing exactly same, using xcode 9.3 also - possibly a problem with that.

@luanachen @mstralka I’m in Xcode 9.3 and was able to pull down the exercise files, do a pod install, and successfully build. Please confirm that you have selected a simulator and not an actual device for your active scheme. Thanks

Hi @scotteg,

Thanks for your help. I’m sure these issues are frustrating because it’s obviously a problem with Xcode, RxSwift, or Swift itself and not your work!

I have a Simulator selected (iPhone 8). Here’s a screenshot:

If I go into the ViewController and build it works but I do get one Swift Compiler warning from RxSwift:

/dev/RxSwiftPlayground/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift:54:17: 'deallocate(capacity:)' is deprecated: Swift currently only supports freeing entire heap blocks, use deallocate() instead

Hi @mstralka, glad you got it working. The warning you see is a known issue.

@scotteg it’s still not working but thanks for sharing that Github issue.

I’ll keep trying clean, build, repeat. Maybe someone else will figure it out too!

Oh, you wrote “it works” so I thought you got it working. Try doing a nuke and repave, which just worked for a reader of the RxSwift book that had similar issues.

Hi @scotteg,

It only worked after installing cocoapods v 1.3.1, but thanks a lot! =)

I’ve been unable to get the project working through CocoaPods, but I was able to get it working using Carthage. Here’s the guide I used that got it working for me: Using Third Party Framework in Playground with Carthage | by Adi Nugroho | iOS App Development | Medium

I’m also having these issues, I’ve tried the cleaning process, installing newer version of RxSwift etc.

I stopped using Playground altogether and just created a simple iOS app and it’s working fine.

Thanks for posting that link @hisaac! I wasn’t able to get it to work with Cocoapods, had the same errors as the folks above but it’s working great with Carthage.

Thanks for your post @hisaac. After trying everything else mentioned above with CocoaPods and being plagued by the same “error: Couldn’t lookup symbols:” issue, I also managed to get this working finally using Carthage. I am using Xcode 9.31 as the Playground CPU performance issue has supposedly been fixed in this version.

Of note, Carthage took an incredibly long time to install. It also took XCode many build attempts to successfully recognize the RxSwift module in the Playground, even though it recognized it in the ViewController from my first attempt. Finally, it took a very long time to successfully launch the simulator and run the playground. All that to say for any other frustrated readers, try Carthage and HAVE PATIENCE!

I was also having an error “no such module RxSwift” … I tried a bunch of the solutions including what was in the installation video and nothing worked.

I then randomly went into the pods dropdown menu, and went to Products, and then toggled “Target Membership” in both Pods_RxSwiftPlayground.framework and RxSwift.framework (and I toggled both frameworks in each .framework file). I tried to build, got another error something “unpredictable results…”, untoggled all “Target Memberships” and now its working…