1

I have a local pod which mocks a bluetooth device. In it there is this line...

CBATTRequest *request = [CBATTRequest new];

Since upgrading xcode, the build errors out saying 'new' is unavailable. Clicking through confirms that in the ios 14.5 SDK, this method (init actually) is indeed marked "unavailable"

/*!
 *  @class CBATTRequest
 *
 *  @discussion Represents a read or write request from a central.
 *
 */
NS_CLASS_AVAILABLE(10_9, 6_0)
CB_EXTERN_CLASS @interface CBATTRequest : NSObject

- (instancetype)init NS_UNAVAILABLE;

...the thing is though, my simulator is set to ios 12.4 and the pods deployment target is set to 12.0.

As stated, this was compiling before I upgraded xcode. The pod dev subteam says it works on ios <= 12.4.

So why is it now compiling against 14.5 rather than 12.x? How do I get it to compile against 12.x?

Hari Honor
  • 8,677
  • 8
  • 51
  • 54
  • The SDK is set by the Xcode version, not the device version or the app target. You need to downgrade your Xcode or see if you can select the SDK from a previous version https://stackoverflow.com/questions/54857416/how-do-i-set-a-previous-base-sdk-in-xcode-10 – Paulw11 Aug 26 '21 at 09:11

1 Answers1

0

In Xcode 12.5 init NS_UNAVAILABLE makes automatically unavailable new. I don't know how it was working correctly with actually unavailable initializer, but now you had to find correct way of retrieving reference to valid CBATTRequest object

Cy-4AH
  • 4,370
  • 2
  • 15
  • 22
  • Yes I understand all of that. My question is how compile it against <12.4. The build settings don't seem to work for that. It's part of a mock and I don't control the source so I cant change the code. – Hari Honor Aug 26 '21 at 09:59
  • There's no way to use earlier ios sdks in xcode 12.5? – Hari Honor Aug 26 '21 at 13:39
  • @HariHonor problem is on the compiler, may be you can just switch command line tool to previous versions? – Cy-4AH Aug 26 '21 at 15:01
  • Can it be switched without needing to download xcode 12.4? – Hari Honor Aug 31 '21 at 12:14