DiveDive
DiveDive

Reputation: 88

AppDelegate unrecognized selector sent to instance

i am working on a project and i am implementing this SDK https://docs.drivequant.com/trip-analysis/ios/get-started and I am implementing it in appdelegeate.m

here how I import the module

@import DriveKitCoreModule;
@import DriveKitTripAnalysisModule;

and here how I initialise it

[[DriveKit shared] initialize];
  [[DriveKit shared] setApiKeyWithKey: @""];
  [[DriveKit shared] setUserIdWithUserId: @""];
  [[DriveKit shared] enableLoggingWithShowInConsole:YES];
 
  [[DriveKitTripAnalysis shared] initializeWithTripListener: self appLaunchOptions:launchOptions];

but I always get this warning with initializeWithTripListener

enter image description here

and after running I got this error

enter image description here

does anyone know why I am getting this error? and how to fix it?

Upvotes: 0

Views: 718

Answers (1)

Duncan C
Duncan C

Reputation: 131503

See this link for a description of how you declare that an Objective-C class conforms to a protocol. (Specifically the section titled "Conforming to Protocols".)

Looking at the readme for the framework you are using, it says:

Make the AppDelegate class implement TripListener protocol. This protocol contains 6 methods to implement:

func tripPoint(tripPoint: TripPoint) {
}
func tripStarted(startMode: StartMode) {
}
func tripCancelled(cancelTrip: CancelTrip) {
}
func tripFinished(post: PostGeneric, response: PostGenericResponse) {
}
func tripSavedForRepost(){
}
func beaconDetected(){
}
func significantLocationChangeDetected(location: CLLocation){
}
func sdkStateChanged(state: State){
}

So you will need to add implementations for those 6 methods to your app delegate. (Those method declarations are in Swift. If you're writing your app delegate in Objective-C you'll need to find the Objective-C function prototypes.)

Upvotes: 1

Related Questions