Regardless, since plenty of people used to have difficulties we’re releasing a different version of the code that doesn’t use CocoaPods for playgrounds - we’re preparing a book update right now
In that case if none of the solutions in those threads worked for you I’d suggest wait just a bit and get the new book version, since all our testers have confirmed the new setup without CocoaPods works for them. We’re working on it and I (personally) hope to get it out some time next week.
I’m trying out Chapter 7, and I’m still getting this error. Any ideas?
Did the normal set up:
“ open the macOS Terminal app (or a similar app of your choice), navigate to the current chapter’s starter folder, and run the bootstrap script, like so:
./bootstrap.sh”
It’s only happening on Chapter 5 still. I have found ways the last day or two around fixing all of the other chapters now, but I can’t fix Chapter 5. (I’ve used fresh repos, cleaned Xcode, simulator, bootstrap clean, derived data, etc etc)
It’s the Playground Sources error still, and it doesn’t find RealmSwift because of that, but I’m not sure how to get this fixed.
Any ideas?
Playground execution failed:
error: /var/folders/45/sn/T/playground7-a67f58..swift:3:8: error: no such module 'Playground_Sources'
import Playground_Sources
I’m having the same issue in Chapter 6. I’m using High Sierra 10.13.5; XCode 9.4.1. I’ve run ./bootstrap.sh and am getting the following error when I click on the little red “something broke” icon after it says “Build Succeeded”
No such module "RealmSwift" Person.swift
and
Playground execution failed:
error: /var/folders/xs/ggpqyccx0m354yl8hfc0y9tm0000gn/T/playground1-ef0f13…swift:3:8: error: no such module ‘Playground_Sources’
import Playground_Sources
I’ve had problems with the playgrounds throughout the book (and it has really convinced me Playgrounds are utter crap and not worth using) - but usually closing down XCode and completely restarting it had worked if I got errors or it went into lala land. This one won’t work at all.
Under the Realm target, it has many red files (meaning it can’t find them). Including a Realm.framework (but there’s one that isn’t red??) and RealmSwift.framework under the Products folder.
Did you do a clean within Xcode? Can you tell me what your Realm/Products/ folder looks like? That whole folder in my project is all red - meaning it doesn’t find the files.
In digging around i’ve also found that there appears to be a typo in the Realm/Configuration/RealmSwift/RealmSwift.xcconfig file:
PRODUCT_BUNDLE_IDENTIFIER = io.realm.RealmSwit;
(note it says io.realm.RealmSwit instead of io.realm.RealmSwift)
Fixing that doesn’t seem to have much of an impact even if I clean and rebuild.
I now can’t get older chapters to work either. The only thing I can think that I changed is I was prepping my real project to start using Realm so I ran the instructions on that site , and part of that was to update pod. “pod repo update”. I don’t know what version of cocoapods I was on before but pod --version now shows me at 1.5.3
One of the other threads suggested to go back to cocoapods 1.4; but I haven’t found instructions to do that yet (or know if it would cause problems with my real projects…)
Editing to update - I think the version of cocoapods is a herring. I checked my history and I was already at 1.5.3; so that doesn’t seem to be it. It looks I’m able to run the sample apps (e.g. BackLinks from chapter 4).
@pknitter, to be honest, I can’t remember the exact steps
I use pod version 1.5.3 so it shouldn’t be a problem.
I’ve modified bootstrap.sh to use RealSwift version 3.7.2 ( latest version)
my xcode version is 9.4.1
I think you better extract a clean copy of the sources from the original files and try these steps:
update bootstrap.sh to point to 3.7.2 (Optional I guess)
run bootstrap.sh
open Playground
you more likely will see the red flag still
select ‘Observing an object’ from the list
on the right-hand side of your xcode, you see ‘File Inspector’ pane
from the ‘Playground settings’ change the platform to macOS and change it back to iOS
this might resolve the issue.
if not, clean the project by pressing CMD+K and try the last step once again. hopefully, it works!
Replying to thread one more time to say it seems to be working now. I ran the app example from Chapter 4 (BackLinks) and then closed that project. I then tried again for Chapter 6 to change Platform from iOS to macOS and then back to iOS in the Playground Settings’ and suddenly it seems to work. I assume that’s a temporary state and will try to take advantage of it while it’s working. I’ve lost several hours of precious time mucking about with this now
So far I’ve loved all the books I’ve bought from raywenderlich.com (iOS Apprentice, Core Data, the countless free tutorials), but the use of Playgrounds is causing me no end of headaches. I hope you never ever ever use Playgrounds as a way to run sample code again. I’d rather run an empty app 50 times in a row than use Playgrounds at this point…