0

Since valid Javascript code can be executed in Objective J, how would I go about adding the Parse SDK?

Following this tutorial: Parse JS SDK

In my project, I can't add the HTML script tag:

<script src="//www.parsecdn.com/js/parse-1.6.14.min.js"></script>

nor can I use:

var Parse = require('parse');

What is the correct way to import Parse?

Justin Moore
  • 884
  • 2
  • 9
  • 22

1 Answers1

1

You need to add the script tag to your index.html and index-debug.html. Inside of these files you will see:

<!-- Custom javascript goes here -->
<!-- End custom javascript -->

So change this to:

<!-- Custom javascript goes here -->
<script src="//www.parsecdn.com/js/parse-1.6.14.min.js"></script>
<!-- End custom javascript -->

Then according to the document you referred to you need to connect your app to Parse server:

Parse.initialize("YOUR_APP_ID");
Parse.serverURL = 'http://YOUR_PARSE_SERVER:1337/parse'

What I would do to add this to the 'init' method:

- (id)init
{
    self = [super init];
    if (self)
    {
        Parse.initialize("YOUR_APP_ID");
        Parse.serverURL = 'http://YOUR_PARSE_SERVER:1337/parse'
    }

   return self;
}

Start Python web server:

python -m SimpleHTTPServer

Check your app in the browser at localhost:8000