0

Hi i'm trying to connect my app to Parse and import the SDK to the view controller.

When doing so (import Parse at the top of viewController, i get an error saying "no such module Parse"

here's the code

import UIKit import Parse

class ViewController: UIViewController {

@IBOutlet weak var signupButton: UIButton!
@IBOutlet weak var loginButton: UIButton!

@IBOutlet weak var passwordTextField: UITextField!
@IBOutlet weak var emailTextField: UITextField!

override func viewDidLoad() {

    let testObject = PFObject(className: "TestObject")
    testObject["foo"] = "bar"
    testObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
        println("Object has been saved.")
    }

    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.



}

///saving the email adress and paswword in background

@IBAction func login(sender: AnyObject) {
    let emailObject = PFObject(className: "\(self.emailTextField.text)")
    emailObject["email"] = "\(self.emailTextField.text)"
    emailObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in

    }
    let passwordObject = PFObject(className: "\(self.passwordTextField.text)")
    passwordObject["password"] = "\(self.passwordTextField.text)"
    passwordObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
        println("successfully signed Up.")



        }


}}

1 Answer 1

2

Create a BridgingHeader.h Add a new file to your project, an Objective-C file. When prompted about creating a bridge header file, approve the request. Add your Objective-C import statements to the created bridge header .h file:

#import <Parse/Parse.h>
Sign up to request clarification or add additional context in comments.

6 Comments

Why would i need to do that since Parse supports swift
It supports Swift but it is not implemented in Swift. If for example you install Cocoa pods and you wish to use a Swift implemented framework , like Alamofire ... then use have to put use_frameworks!. Then you will import everything like you have in your initial code.
yes but how comes it did work the first time and now it doesn't. without mentioning the fact that i added abridging header in which i imported Parse and get to basically the same error "Parse.h" not found
it does not even make sens since I have the Parse.h file in the Parse framework so I really don't understand why. Anyone that would have a solution would save me. currently my bridging header file is right underneath supporting files
found the solution : Here is the complete ulitimate answer. Struggled with this for about an hour today. When you download parse into your downloads folder if you already have a parse framework in your downloads your mac will rename it to Parse 2.framework or Parse 3.framework. When you add it to the project it is added as Parse 4 not Parse. This causes all sorts of errors. The correct thing to do is A. Delete the Parse framework out of your project B. rename the folder from Parse 4.framework TO Parse.framwork C. Re add it to the project
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.