Reputation: 17132
I'm trying to use the backendless API for registering a user. I did everything step by step needed to correctly import the framework.
The AppDelegate.swift is accepting the framework.
func application(application: UIApplication, didFinishLaunchingWithOptions
launchOptions: [NSObject: AnyObject]?) -> Bool {
backendless.initApp(APP_ID, secret:SECRET_KEY, version:VERSION_NUM)
// DebLog.isActive = true
backendless.hostURL = "https://api.backendless.com"
backendless.initApp(APP_ID, secret: SECRET_KEY, version: VERSION_NUM)
return true
}
But as soon as I use backendless in my ViewController, I receive an error.
@IBAction func rememberMe(sender: AnyObject) {
backendless.userService.stayLoggedIn = sender.on
}
Use of unresolved identifier 'backendless'
I started the project and the import 3-4 times and did it exactly like explained in the documentation, but I always receive this error. I appreciate every help.
Upvotes: 0
Views: 1135
Reputation: 5213
Create a new project in Xcode as you normally would, then close the project.
Open a Terminal window, and change the current directory to be the project's directory.
Run the following command in the Terminal window, which will create a file with the name Podfile.
pod init
Open the created Podfile using a text editor and add the following text inside of the target block:
pod 'Backendless', '4.0b2'
Save Podfile, return to the Terminal window and run the following command:
$ pod install
Don't forgot pod update $ pod update
Once the pod is downloaded, Xcode project workspace file will be created. This should be the file you use to open the project in Xcode.
If you develop with Swift, you will need to add a Swift bridging header. To do that, click the root node in the Project Structure and select the Build Settings section. Locate the Swift Compiler - General section. Enter the following value into the Objective-C Bridging Header field:
Pods/Backendless/SDK/ios/backendless/include/Backendless-Bridging-Header.h
Open .xcworkspace file to launch your project, and build it.
For more detail Please open below link https://backendless.com/docs/ios/doc.html#setup
Upvotes: 2
Reputation: 114875
If you look towards the top of the AppDelegate.swift
file you will see
var backendless = Backendless.sharedInstance()
This sets the backendless
instance variable to the shared instance of the Backendless framework, but this instance variable is local to the AppDelegate instance. You need this same line in your ViewController.swift
otherwise the compiler doesn't know what backendless
is - it is an unresolved identifier
Upvotes: 0