Realm - Building Modern Swift Apps : Script Error

Glad to hear that solved it for you! We hope to have a more permanent solution soon :slight_smile:

Partial success!! I downgraded Cocoapods to 1.4.0 and got the Playground working on my MacBook. It is a bit unstable and shuts down occasionally or goes into la-la land BUT it works so thanks for the workaround. Now I can work along through the Book.

I found another problem, possibly related, on my iMac which I also downgraded to Cocoapods 1.4.0. Here the bootstrap code reports “Xcode is not installed” which is odd since I am working on other projects in Xcode without any problem. Also I cannot use SimPolders on the iMac as it can’t find any simulators. I am still researching this problem but any ideas would be gratefully received.

Richard

If both our script and SimPholders fail, I suspect something is broken with your Xcode setup.

Could you try running
xcode-select -p
and examine the output?

Also try
sudo xcode-select -s /Applications/Xcode.app
To set the correct path to the used Xcode installation.

Shai.

The output from Xcode-select -p was /Applications/Xcode.app/Contents/Developer

Your other suggestion has enabled SimPholders to work so that’s a Win.

Thanks for your patience, I am getting there now and enjoying learning about Realm. As you can guess I am not particularly skilled at Swift and all but I do enjoy the challenge of learning new skills.

Richard

Downgrading to CocoaPods 1.4 works for me too. Thanks @freak4pc

1 Like

Super @scottschmidt … this approach seams to be the best one till the problem is solved (in v1.1?)

Another update on this:
We’ll be releasing relatively soon an updated Playgrounds edition that doesn’t rely on CocoaPods at all. For the time being, with the existing version there are two workarounds :

  1. Use CocoaPods 1.4 instead of 1.5
  2. If you must use 1.5, you can add the following at the end of your Podfile:
# Workaround for Cocoapods issue #7689
post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
        config.build_settings.delete('CODE_SIGNING_ALLOWED')
        config.build_settings.delete('CODE_SIGNING_REQUIRED')
    end
end
1 Like

@freak4pc I’m using CocoaPods 1.5 and don’t want to downgrade to 1.4 on my work machine. Adding the code shown to my Podfile did not work. I added the directive shown to the existing post_install block and ran pod update. Is there anything else I need to do?

It does seem to work on my end. Could you make sure you’re doing a hard clean e.g. Cmd+Alt+Shift+K

Also try clearing your derived data, from the command line:

rm -rf ~/Library/Developer/Xcode/DerivedData/RealmPlayground-*

Good call. The hard clean and clearing derived data did the trick.
Thanks @freak4pc

1 Like

the whole pod looks like this:

platform :ios, ‘11.0’

target ‘RealmPlayground’ do
use_frameworks!
pod ‘RealmSwift’, ‘3.3.0’
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings[‘CONFIGURATION_BUILD_DIR’] = ‘$PODS_CONFIGURATION_BUILD_DIR’
end
installer.pods_project.build_configurations.each do |config|
config.build_settings.delete(‘CODE_SIGNING_ALLOWED’)
config.build_settings.delete(‘CODE_SIGNING_REQUIRED’)
end
end
end

You may also download v1.1 of the book that resolves all playground issues.

1 Like

Unfortunately not. :confused:
macOS Sierra, Xcode 9.2

Hey @appliedpda - The book states we only officially support Xcode 9.3 / iOS 11 and up. Could you please try updating your Xcode ?

Thanks
Shai

Xcode 9.3 requires High Sierra. So now I need to update an entire OS? I like how my machine is setup and works just fine. I’ll be investigating the cocoapods path to try and get this playground to work then.

I understand this being frustrating, but to avoid maintaining different scripts for different OSes and support legacy users, all of the RW Books and Tutorials usually revolved around “Latest and Greatest”.

I think that creating a playground and dropping the “Realm” project from GitHub in the same Workspace should work fine if you want to try the manual path.

Good luck :slight_smile:
Shai

Running Xcode 9.4 and MacOS High Sierra 10.3.5, as well with cocoapods 1.5. But I keeping getting an error that Xcode is not installed when i run the code in terminal.
19%20AM

Did anyone else get the error? If so any solution. Thanks. This is for chapter 3 playing with playgrounds. Worked fine using chapter with Xcode project todo app.

Can you try running xcodebuild in a terminal? @briancanela

So in my build tools, the terminal was not connect to Xcode, I fix that part. Now when I run the line ./bootstrap.sh clean it runs smooth, but in terminal shows that cp: /tmp/RW/Realm/3.4.0: No such file or directory when fetching Realm v3.4.0. Currently I am using the latest version of Realm 3.7.1.

.

@freak4pc

1 Like

Realm should be downloaded automatically, so the version you’re using shouldn’t matter. Can you download the latest 1.1 and try again? Also, can you make sure it is the actually correct xcodebuild (perhaps via ‘which xcodebuild’)