Chapter 2: Observables project problems

creating an Info.plist file and changing the workspace settings worked for me. Xcode 8.3.1

Hi faaballa,
This worked for me with Xcode 8.3:

  • After ‘pod install’ open workspace in Xcode.
  • Click on Pods-project and select RxSwift target
  • Click on ‘Build Settings’-tab and search for ‘swift_version’
  • Set swift_version value to ‘Swift 3’
  • Build project
    After that everything works fine with Xcode 8.3.
1 Like

Thanks roguebyte, now I can use Xcode 8.3.:grin:

Had this problem intermittently. Turns out that this Info.plist error is only an issue when (accidentally) building for a physical device. The intermittent nature is explained by this only occurring when my iPhone was attached to my MBP, setting the scheme to the physical device.

Ensuring your scheme is set to a simulator and rebuilding resolves this issue:

5 Likes

Nothing In the forum helped me to solve issue with Xcode 8.3 I run pod install.

But My build succeeds but I am unable to open playground.

RxSwift is awesome. I am now discovering completely new conceptual ideas to clean up my event-driven asynchronous programming mess. Thanks to the RW team for writing this book. Excellent stuff! :clap: :smiley:

However, just like many of your readers before me, I am having the same problems getting started with the installation, the pods, the playground and Xcode. Not sure where the problem lies, but this should not be made difficult for your readers. Please. :pray:

I executed successfully all steps 1…5 on page 40. I also ran pod update following the Note (in gray box) on page 41. Still, I am getting the error in playground No Such module ‘RxSwift’.

Can anybody provide me any hints how to fix this issue? I would very much appreciate it! :raised_hand:

I’m including a couple of screenshots to show the state of my despair… I am using Xcode 8.3.2

  1. Workspace build succeeds:

  2. pod update (appears OK, but I’m no CocoaPod expert):

  3. Running RxSwift Playground … no good… No such module ‘RxSwift’

Once again, I am no CocoaPod expert. Perhaps something is not quite right with the installation setup and needs to be modified… Help. Please. :confused:

Hi @realliverobot, thanks for the positive feedback and sorry you’re having such a hard time getting this to work. I have found that taking the following steps resolves all problems (I realize that deleting the derived data supersedes cleaning the build directory, but follow all these steps anyway, as I would usually try each of these steps individually and progressively in the order provided to try and resolve this and similar problems with Xcode and CocoaPods):

  1. Open the project via the .xcworkspace file.
  2. Do a clean (command + shift + k), followed by a deep clean (command + option + shift + k).
  3. Close the project (but do not quit Xcode).
  4. Open Xcode > Preferences… > Locations.
  5. Click the arrow to go to your Derived Data folder.
  6. Delete the project’s derived data folder; sort by Date Modified to help find it. If you are still having a hard time determining which folder is specific to the project in question, delete them all.
  7. Quit Xcode.
  8. Restart your Mac.
  9. Open Xcode.
  10. Open the project directory in Finder.
  11. Delete the Pods folder and the Podfile.lock file; do NOT delete the Podfile file.
  12. Open Terminal to the project directory.
  13. Run pod install.
  14. Do a build (command + b).
  15. Let Xcode complete the indexing process.

You should now have a functioning project and playground. However, if not, or if you don’t want to run all these steps, I have uploaded a working version of the starter playground with both RxSwift and RxCocoa imported here. Depending on the chapter, you may need to add helper code to the SupportCode.swift file in the Sources folder, as indicated in the chapter.

Please confirm that you’re all set or still have issues, and enjoy the rest of the book!

3 Likes

@scotteg, thank you so much for taking your time to write-up the detailed step-by-step procedure. Unfortunately it did not work. I followed the steps exactly as you wrote (including cleaning, deep-cleaning, deleting all the derived data). Restarted the machine. Reinstalled CocoaPods. Build workspace. Let Xcode finish indexing. Everything as described above, carefully following the sequence of prescribed steps. Same message in Playground: No such module ‘RxSwift’

By the way, this time there’s been some improvement: The build finishes with some warnings (none of the component names marked in red). And I assume that these warning can be safely ignored…

So I followed your second option recommendation. I downloaded your starter playground with imported files from the link you provided. But the result is exactly the same. After I build the workspace, let the indexing complete, and then launch playground, I get the same message No such module ‘RxSwift’.

I have no idea… Here’s some info about my environment, I’m not sure if this is relevant or needed… but I cannot imagine why the setup you have on your machine is working for you, and not working for me (and a few other people I’m pretty sure).

I still would really want Chapter 2 example to work so that I can experiment through the progression of knowledge in the book, as the RW team conceived when creating the book. Or perhaps should I abandon the Playground idea, and start experimenting with this chapter by creating an Xcode project. Perhaps not as elegant, in this case, but less prone to installation and setup problems?

@scotteg , one more thing that may or may not be relevant to our problem.

After I build the workspace successfully, and without closing the workspace in Xcode, if I double click the playground file in the Finder trying to launch the playground, I get this popup error:

I can only launch the playground after I first close the workspace. Sorry, I do not quite understand how Playground+Xcode+CocoaPods+RxSwift interact with each other here. So many moving parts… :wink:

I’m not sure if this is expected or not. I can only launch the playground after I close the workspace first. Of course the error No such module RxSwift is still there. I just thought I mention this point.

1 Like

My bad, bad, bad dog!!! This popup that I attached above was the crucial point of my confusion. :joy: And I have just discovered my own silliness. So for anybody who’s ever have had a similar “problem”:

After the building and indexing of the RxSwift.xcworkspace is finished, simply go to your Navigator pane and click on RxSwift playground.

Do not try to open the playground from the Finder, as this will cause you pain and misery.

I guess I was used to always launching the playground from the Finder, and I have never previously opened a playground file from within the Xcode workspace in the way as it should be done in this chapter examples. And then, of course, I did not quite understand what the Xcode popup was saying and why it was saying so.

My apologies for wasting your time @scotteg and @icanzilb, and perhaps in the next revisions of your pdf book, you might consider providing a more explicit procedural guideline how to get this example in chapter 2 running properly to avoid the basic misunderstanding like mine. Pictures and illustrations also work exceptionally well.

Cheers!

Glad this is resolved. I’ve been planning for some time to make a video about how to open those book projects, since it’s not exactly straight-forward. I should do it asap to help in cases like yours :vulcan_salute:

I also am having problems with running the starter playground. I copied the starter project into another folder and worked from that.

On trying to run I get a popup error that reads,
‘The file “RxSwift.playground” couldn’t be opened because you don’t have permission to view it. You don’t have permission’.

I’ve tried all the detailed steps provided by @scotteg, and installed an Info.plist from another project as that appeared to be missing from the starter project. I also changed to my developer profile.

Build succeeds, but when I try to run I get the same message. I’ve cleaned and deep cleaned.

I’ve checked file permissions for the folder and contents but everything appears normal. On Googling I checked to see that $(EXECUTABLE_FILE) is set, and adding the info.plist seemed to take care of that.

When I check ownership in the Finder I see that I own the file. I’m obviously missing something here. Anything else I can try?

The error popup

The build location

Finder get info on the build product

I have not yet solved this problem in Xcode 8.3.2

Error message : “The file “RxSwiftPlayground” couldn’t be opened because you don’t have permission to view it.”

Pls help me, thanks in advance!

We already had somebody have the same error - they said when they copied the files to another location on their computer it worked fine.

Pls explain more detail, do you mean coping all RxSwiftPlayground folder to another location?

thank you, the problem 's been solved:)

I follow the answer https://stackoverflow.com/questions/42082864/how-to-import-rxswift-in-playground-of-xcode

then, just drag SupportCode.swift into the sources folder

ok, we can play now~

1 Like

I am running RxSwiftPlayground on Xcode 9, Swift 4.

I found that adding and empty Info.plist and then going to Workspace Settings and setting Derived Data to Workspace-relative Location did the trick!

Best of luck to anyone else running this on Swift 4.

Also, drop this in your Podfile:

pod ‘RxSwift’, :git => ‘GitHub - ReactiveX/RxSwift: Reactive Programming in Swift’, :branch => ‘rxswift4.0-swift4.0’

I am using xCode 9.2 and these instructions worked for me. Thank you so much!!

This works for me thank you!