Why does my PFAnalytics not have trackAppOpeneWith

2020-06-07 04:29发布

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

3条回答
一夜七次
2楼-- · 2020-06-07 05:02

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
{ 
...
}
查看更多
仙女界的扛把子
3楼-- · 2020-06-07 05:14

Try

PFAnalytics.trackAppOpenedWithLaunchOptionsInBackground(launchOptions, block: nil)

instead of

PFAnalytics.trackAppOpenedWithLaunchOptions()
查看更多
Evening l夕情丶
4楼-- · 2020-06-07 05:14

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

查看更多
登录 后发表回答