Objective-C Category Causing unrecognized selector

后端 未结 7 731
误落风尘
误落风尘 2020-12-01 02:52

My project has a UIImage category function that I want to call from another class. I properly import the header file for the image category and I get the projec

相关标签:
7条回答
  • 2020-12-01 02:57

    May be because you write imageNamed instead of imageNamedDR in the interface..

    0 讨论(0)
  • 2020-12-01 03:05

    Another possibility.

    You have the implementation of category but do not have an interface. I mean you forgot to declare in *.h the interface of your category.

    0 讨论(0)
  • 2020-12-01 03:09

    I had the same issue and had to apply this fix as well. My NSDate-Extensions.m source file wasn't compiling so I had to go into Project Settings, then select the appropriate target, then click the "Build Phases" tab, then expand the "Compile Sources" items, then click the + symbol and manually add my NSDate-Extensions.m file.

    0 讨论(0)
  • 2020-12-01 03:14

    I had this error message and I am using Cocoapods. To fix the error, I just needed to call pod install again to create all the necessary linking correctly.

    0 讨论(0)
  • A couple possibilities:

    1. You did not link UIImage+TTShare.m into your target. So while you have the header, you're not compiling the implementation.
    2. If this is part of a static library, you need to add -all_load to the Other Linker Flags build setting for the app linking against the library.
    0 讨论(0)
  • 2020-12-01 03:18

    If you want to use Category method, you must add -ObjC to the Other Linker Flags build setting of your APP.

    0 讨论(0)
提交回复
热议问题