Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Self-Destructing Message iPhone App Using Parse.com as a Backend and Adding Users Creating an Account and App on Parse.com

I am using Swift and having a problem using any of the code from Parse. I cant connect or test the SDK.

Hi I am new to iOS development and I am using Swift. All my files are .swift files and even though I was able to import the framework files, I am unable to connect the app to Parse or test the SDK. It stops me at the connecting phase (when I try to #import <Parse/Parse.h> since I do not have an AppDelegate.m file. Am I better off writing this in Obj-C instead? Any help would be greatly appreciated. Thanks

1 Answer

Hey,

Instead of downloading Parses objective-c files, download the iOS Swift version.

Next link the following frameworks, the same way

AudioToolbox.framework
CFNetwork.framework
CoreGraphics.framework
CoreLocation.framework
MobileCoreServices.framework
QuartzCore.framework
Security.framework
StoreKit.framework
SystemConfiguration.framework
libz.dylib
libsqlite3.dylib

Then in the AppDelegate.swift file

Note the difference in the import statement, in Swift, you don't use the #import, just import.

import Parse
import Bolts

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // [Optional] Power your app with Local Datastore.
    Parse.enableLocalDatastore()

    // Initialize Parse.
    Parse.setApplicationId("YOUR APP ID", 
      clientKey: "YOUR CLIENT ID")

    // [Optional] Track statistics around application opens.
    PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)

    // ...
}