Prior to xcode 9.3, the following code snippet worked fine:
CKRecord *thePublicGameRecord;
...
//the record value, thePublicGameRecord[KEY_PLAYERSTATES], is set to a NSMutableArray, the size of which is based on the number of players in the game.
...
for (int i = 1; i <= max_number_of_players; i++)
{
NSNumber *playerState - thePublicGameRecord[KEY_PLAYERSTATES][i];
...
}
Since upgrading to xcode 9.3, this line:
NSNumber *playerState - thePublicGameRecord[KEY_PLAYERSTATES][i];
Now gives a build error:
Expected method to read array element not found on object of type '__kindof id < CKRecordValue > _Nullable'
and I have to unwrap the underlying array like so:
NSMutableArray *statesArray = thePublicGameRecord[KEY_PLAYERSTATES];
playerStatus = statesArray[i];
That's not the end of the world, but I preferred the original approach.
I've read many other questions reporting this error, but they all look like different scenarios (incorrect definitions of custom protocols, mismatched variable types, and/or issues prior to the release of xcode 4.5).
Expected method to read array element not found on object of type 'id<ProtocolName>'
Compiler error "expected method not found" when using subscript on NSArray
expected method to read dictionary element not found on object of type "NSDateFormatter*"
Since this code has been working for more than a year, I believe the error results from some change in enforcement. In xcode 9.3, does this stem from some new/changed config setting, and can I fix it?