0

I'm using SWXMLHash to parse an xml file in my project, It works fine in the project but I would like to make some tests in a playground.

I keep having an error when I want to use the library in the playground:

Playground execution failed: test.playground:5:8: error: no such module 'SWXMLHash' import SWXMLHash ^

  • I tried to delete the files in the derived data folder.
  • I tried to clean and build, nothing seems to work.
AziCode
  • 2,510
  • 6
  • 27
  • 53
  • 2
    Have a look at my answer here about a similar issue: http://stackoverflow.com/a/35818746/2227743 – Eric Aya Mar 22 '16 at 22:21
  • @EricD. Do you know what to do to avoid this error : `ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.` – AziCode Mar 23 '16 at 00:06
  • @EricD. and when I use sudo I get another error : `ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/carthage-play` – AziCode Mar 23 '16 at 00:07
  • 1
    Unfortunately you're in the "my Ruby install is broken" pool. First, I highly recommend against using the system's Ruby install - it would force you to install Gems with sudo and will lead to many issues later. You should use something like RBENV or RVM or CHRUBY to install a clean Ruby version. It can be a bit cumbersome but you only have to do it once. – Eric Aya Mar 23 '16 at 11:25
  • Tks @EricD. should I uninstall my current ruby and install one of these : RBENV, RVM or CHRUBY to install a clean Ruby version. – AziCode Mar 23 '16 at 18:07
  • 1
    You don't have to uninstall anything. When you will have installed, say, RBENV, you will be able to use RBENV to download and install a new, contained, version of Ruby. RBENV is what downloads, installs and manages the new Ruby install (the idea is to not use the one already installed in the system). The *system Ruby* will not be changed, you will just *add* new Rubies handled by RBENV. – Eric Aya Mar 23 '16 at 18:10

1 Answers1

0

I finally managed to make the 3rd party library work in the playground by following the steps provided in the apple docs:

https://developer.apple.com/library/ios/recipes/Playground_Help/Chapters/ImportFramework.html

I followed the Alternative solution, and now I can use the 3rd party library inside my playground.

Thanks to David Mohundro the creator of SWXMLHash for the link.

AziCode
  • 2,510
  • 6
  • 27
  • 53