0

With the latest XCode (8.0 (8a218a) release, my app now fails to build with the error message

"No known instance method for selector 'setEnabled'"

Here is the code, error flagged at the second last line. -

if (alertView.tag == PURCHASE_TAG) {
    //NSLog(@"***Purchasing****");
    /*
     [BaseFunctions deleteKeychainValue:@"InstallDate"];
     [BaseFunctions createKeychainValue:[BaseFunctions getCurrentYearMonthDate] forIdentifier:@"InstallDate"];
     NSData *passwordData = [BaseFunctions searchKeychainCopyMatching:@"InstallDate"];
     if (passwordData) {
     installDate = [[NSString alloc] initWithData:passwordData
     encoding:NSUTF8StringEncoding];
     }
     NSLog(@"***InstallDate = %@", installDate);
     */
    [SVProgressHUD showWithStatus:@"Purchasing"];
    [[[[UIApplication sharedApplication] windows] objectAtIndex:0] setEnabled:NO];
    [[InAppPurchaseHandler sharedInAppPurchaseHandler] getProductInfoList];
}

I can't find any reference to the setEnabled parameter and I am not sure how the line should be modified.

Janmenjaya
  • 4,149
  • 1
  • 23
  • 43
Rob Slater
  • 225
  • 1
  • 6

2 Answers2

0

UIView does not have a setEnabled: selector, but it has a setUserInteractionEnabled: selector which disables user interaction with the UIView.

[[[[UIApplication sharedApplication] windows] objectAtIndex:0] setUserInteractionEnabled:NO];

It does however not change the visual state of the UIView but that might also not be the intention.

masam
  • 2,268
  • 1
  • 22
  • 24
-1
UIView *window = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
[window setEnabled:NO];
pacholik
  • 8,607
  • 9
  • 43
  • 55
Sachin Vas
  • 1,757
  • 12
  • 16