Category Conflict: instance method in category from conflicts with same method from another category
Asked Answered
N

4

20

There are two situations, that I am aware of, that cause the following errors:

ld: warning: instance method 'resetAudioSystem' in category from /opentok-ios-sdk/Opentok.framework/Opentok(OTPublisher+AudioSnoop.o) conflicts with same method from another category
ld: warning: instance method 'attachAudioSnoopBlock:' in category from /opentok-ios-sdk/Opentok.framework/Opentok(OTPublisher+AudioSnoop.o) conflicts with same method from another category
ld: warning: instance method 'setVideoSnoopDelegate:' in category from /opentok-ios-sdk/Opentok.framework/Opentok(OTPublisher+VideoSnoop.o) conflicts with same method from another category

Possibility 1: A category instance method is declared twice. (Described here: SO)

But, When I do a search of any of the 3 instance methods (in Xcode or Grep) I do not find it declared twice.

Possibility 2: Accidentally importing a .m file. (Described here: SO)

But, I checked all my imports and I only import the framework once in the whole project. Also, only shows up once in Build Phases.

My program runs without crashing, presumably because the last category definition added is used and it happens to be correct. (Source)

Question 1: Is there a way to tell, prior to its addition, where the two categories are located?

Question 2: Any other ideas about how to resolve this?

Note: The Opentok Framework is a binary

Occurs in :

xcode 4.6 & xcode 5

iOS6 & iOS7

Novotny answered 12/11, 2013 at 5:35 Comment(2)
Check your search paths. Build Settings > Search Paths. I have had similar issues in the past and most of the time it came down to the Search Path.Photoemission
Is the selected answer correct? The highest voted seems like the correct one to me.Glauconite
O
4

This look like a linker bug. Maybe the SDK got linked more than once, or -ObjC is missing/present where it should not be. Check linker flags. Try deleting all OpenTok frameworks, make sure its missing in your projects, then re-download it and install again.

Odeen answered 19/11, 2013 at 0:16 Comment(0)
T
41

I had this warnings because I accidentally imported the implementation file of a category instead of it's header file. So:

wrong: #import 'MyClass+MyCategory.m'

right: #import 'MyClass+MyCategory.h'

Tynes answered 25/8, 2014 at 19:57 Comment(0)
H
6

I had this error, because I literally pasted my methods' implementation to header file (*.h). It worked well however; the only symptom - warnings.

Check whether your implementation is in correct (*.m) file.

Hyetography answered 22/4, 2015 at 18:5 Comment(0)
O
4

This look like a linker bug. Maybe the SDK got linked more than once, or -ObjC is missing/present where it should not be. Check linker flags. Try deleting all OpenTok frameworks, make sure its missing in your projects, then re-download it and install again.

Odeen answered 19/11, 2013 at 0:16 Comment(0)
I
0

In my case the header file containing the categories was imported twice for a class. It wasn't obvious because another header file also imported the same header. In other words

//Class_with_warnings.h:
#import "Offending_Header.h" // import #1
#import "Class_A.h"          // import #2

//Whereas Class_A.h:
#import "Offending_Header.h" // import #2
Izmir answered 17/6, 2021 at 2:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.