The compiler thinks that your else clause causes semantic ambiguity. what do you mean? Whether a is equal to 10 or not, if must assign a value to 100 after execution, or just assign a value to 100 in the else clause (that is, when a is not equal to 10? 61. warning "addexplicit braces to avoid dangling else"
The so-called "dangerous else" is code similar to this:
I
f(a== 10)printf("TEN");elseprintf("NOT TEN");a = 100;
The compiler thinks that your else clause causes semantic ambiguity. what do you mean? Whether a is equal to 10 or not, if must assign a value to 100 after execution, or just assign a value to 100 in the else clause (that is, when a is not equal to 10?
If it is the former, the correct statement should be:
If (a = 10) {printf ("TEN") ;}else {printf ("not ten") ;}a = 100; if it is the latter, the correct syntax should be: if (a = 10) {printf ("TEN");} else {printf ("not ten"); a = 100 ;}
Of course, for the c/c ++/java compiler, this is only a small problem and will not cause compilation failure. The compiler actually prefers the former, which is automatically handled in the first case. But it will warn you that this is a bad code style and you can ignore this warning with the # pragma clang diagnostic ignored "-Wswitch" macro, or set the compilation option MissingBraces and Parentheses to NO.
62. the Home key is not displayed on the iPad simulator.
In Xcode 4.3, the Home key is not displayed on the iPad simulator for a larger user space. You can replace the Home key by selecting "Hardware> Home Page" or pressing the ⇧ ⌘ H shortcut.
63. Novisible @ interface for 'nsurl' declares the selector 'query'
In iOS6, this method is discarded. use NSURL + Parameters instead.
64. certificateidentity 'iPhone distribution 'appears more than once
This is a duplicate certificate error. you need to delete and compile the duplicate certificates in the key string to pass the compilation. However, if you restart Xcode, you will find that the previously deleted certificate is back. However, when you restart Xcode, the certificate in Xcode will be imported into the key string. Therefore, deleting duplicate certificates in the key string is invalid.
I believe that many of you have been so disgusted with Xcode's Bug, but there is no way to delete the certificate from the key string repeatedly (but in vain. In fact, it's not just Xcode, but it's also related to "iPhone configuration tools.
These "residual" certificates in Xcode do not exist in the regular form. If you have installed the "iPhone Configuration Utility", these certificates are actually stored in the/Users/km-cn/Library/MobileDevice/Applications/directory. in the app file. the app is actually the app imported from "iPhone Configuration Utility"-"application. You can use the Finder -- "show package content" to view the. app. One file named "embedded. mobileprovision" is the "residual" duplicate certificate. You can delete these items one by one. app, you can also simply put all. all apps are deleted (you can compile these files whenever the project file exists. app and import it to "iPhone Configuration Utility ). Finally, delete the duplicate certificate in Orgnizer and restart Xcode.
65. Application Identifier 'com. ydtf. * 'which doesn' t match the current setting 'com. ydtf. dlt'
As you can see, the two Application IDs are absolutely matched (* represents a wildcard ). But this inexplicable error will make you unable to compile. This is definitely another Bug in Xcode. First, change CodeSigning to Don't Code Sign and Build, and then modify the correct signature Build.
66. Theidentity used to sign the executable is no longer valid.
Archive cannot be created due to the previous signature issue. For the solution, see question 65.
67. use presentModalViewController in iPad to set the size of the pop-up window
TestViewController*testVC = [[TestViewController alloc] initWithNibName:@"TestViewController"bundle:nil];testVC.modalPresentationStyle= UIModalPresentationFormSheet;testVC.modalTransitionStyle= UIModalTransitionStyleCrossDissolve;[selfpresentModalViewController:testVC animated:YES];testVC.view.superview.frame= CGRectMake(0, 0, 649, 397);//it's important to do this afterpresentModalViewControllertestVC.view.superview.center = self.view.center;
Note: // it 'ortant ant to do this after presentModalViewController. That is, you must set the frame size after [selfpresentModalViewController: testVC animated: YES!
68. customize the ActionSheet button and Popover Arrow direction in the iPad.
ActionSheet is displayed as a Pover on the iPad. The cancelButton is not displayed by default. (the SDK replaces the cancelButton with a region other than the Popover. you only need to click a region other than the Pover to click the cancel button ). If you init an ActionSheet like this:
UIActionSheet* sheet=[[UIActionSheet alloc]initWithTitle:nildelegate:selfcancelButtonTitle:@"cancel"destructiveButtonTitle:@"ok"otherButtonTitles:nil];
Only the red destructiveButton is displayed.
If you want to display cancelButton, you can do this:
UIActionSheet* sheet=[[UIActionSheet alloc]initWithTitle:nildelegate:selfcancelButtonTitle:nildestructiveButtonTitle:nilotherButtonTitles:@"cancel",@"ok",nil];// sheet.cancelButtonIndex=0;sheet.destructiveButtonIndex=1;
After destructiveButtonIndex is specified, the button is displayed in red.
Do not specify cancelButtonIndex because cancelButton will be removed from the iPad.
In the iPad, the SDK does not provide an API for modifying the Arrow direction of the actionSheet. The system automatically determines the direction of the arrow. However, we can use the showFromRect 1st parameter to change the direction of the arrow:
CGRect r=sender.bounds;r.size.width=2*self.view.bounds.size.width;r.origin.x=-self.view.bounds.size.width+sender.bounds.size.width/2+sender.frame.origin.x;[sheet showFromRect:r inView:sender animated:YES];
In this way, the original left arrow is replaced with the top arrow.
In fact, the logic for iOS to determine the direction of the actionSheet pop-up is very simple. if there is "enough" space on which side, it will pop up on which side. When we use the showFromRect's 1st parameters to "block" all three directions, it will only pop up from the desired direction honestly.
69. in ASINetworkQueue, setShowAccurateProgress = YES does not work.
Add request. showAccurateProgress = YES before networkQueue. showAccurateProgress = YES. otherwise, showAccurateProgress will not take effect. Sample code:
equest.showAccurateProgress=YES;networkQueue.showAccurateProgress=YES;[networkQueue setSuspended:YES];[networkQueue addOperation:request];networkQueue.uploadProgressDelegate=self;[networkQueue go];
In addition, due to a Bug in CFNework, the exact upload/download progress of Data smaller than KB cannot be tracked.
70. how do I set the background color of UIWebView to transparent?
Setting the Background attribute of UIWebView in IB to Clear Color does not make the Background transparent. To achieve this goal, you need to use the following two sentences:
[webView setBackgroundColor:[UIColor clearColor]];[webView setOpaque:NO];
The above is the content of iOS development FAQ (6). For more information, please follow the PHP Chinese network (www.php1.cn )!