Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my PFAnalytics not have trackAppOpeneWithLaunchOptions function? (IOS SWIFT)

Error message:

    'PFAnalytics.Type' does not have a member named 'trackAppOpenedWithLaunchOptions'

All other similar functions work, e.g. trackAppOpenedWithLaunchOptionsInBackground. It looks like that it just simply disappears from the list of available functions.

But in my PFAnalytics.h header file, trackAppOpenedWithLaunchOptions is clearly listed as shown below:

    + (BFTask *)trackAppOpenedWithLaunchOptions:(NSDictionary *)launchOptions;

What might have been wrong? Please help! I am using swift

like image 705
donkey Avatar asked Oct 22 '14 09:10

donkey


3 Answers

The method is declared to return a BFTask * object, which is part of the Bolts framework. Make sure your project is linking the Bolts framework, and then add

#import <Bolts/Bolts.h>

to your bridging header.

This solved a few "missing" APIs in Swift for me (this one, as well as PFObject.saveInBackground mentioned here: PFObject does not have a member named 'saveInBackground' in Xcode 6.0.1, Yosemite GM3

like image 59
Greg Fagan Avatar answered Oct 30 '22 23:10

Greg Fagan


Try

PFAnalytics.trackAppOpenedWithLaunchOptionsInBackground(launchOptions, block: nil)

instead of

PFAnalytics.trackAppOpenedWithLaunchOptions()
like image 23
Koop Otten Avatar answered Oct 30 '22 22:10

Koop Otten


No need for bridging headers since release 1.0. To fix the issue, just add, import Bolts at the top of your AppDelegate as such:

import UIKit

import Parse
import Bolts

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
{ 
...
}
like image 7
Zorayr Avatar answered Oct 31 '22 00:10

Zorayr