Search code examples
iosstatic-librariesstatic-linking

-[UIView setAdUnitID1:]: unrecognized selector sent to instance


I have created a static library of a UIView libLinOneSdk.a. So i am getting crash when i am using it's property or funcitons. but if i am using LinDFPBanner.m Everything is working fine, In Storyboard i have hooked it in nib also. I searched but got no clue why in static libraries this is happening. The problem may be of Library Search Path. can anybody help me how can i give library search path.

enter image description here

 self.linBannerView.adUnitID1 = @"XXXX";
    self.linBannerView.rootViewController1 = self;

Also app is working fine in ipod touch5 and ipad mini. crashing in simulator and iphone 5s. it can be architech problem.

Do i need to create a framework rather static library ? because it's not working in iphone 5s


Solution

  • The library libLinOneSdk.a only contains code for the armv7 architecture. iPhone 5s is 64-bit, so you need to include the 64-bit architecture code. You need to follow instructions for building a fat library first. After you do that, then you will need to follow the instructions below to get things linked properly.


    When linked from a static library LinDFPBanner is getting dead stripped. To ensure it doesn't get dead stripped you need to add a reference to LinDFPBanner in your code. You can do so by adding the following code:

    - (void)dummyMethod
    {
      [LinDFPBanner class];
    }
    

    This will cause the class to be referenced and it should load properly when needed.