61. Warning "addexplicit braces to avoid dangling else"
The so-called "dangerous Else" is a code like this:
if (a== 10)
printf ("TEN");
Else
printf ("Not TEN");
A = 100;
What do you mean by the compiler that your else clause leads to ambiguity? Whether a is equal to or not, if you want to assign a to a value of 100 after execution, or if you want to assign a value of a to 100 in the ELSE clause (that is, a is not equal to 10)?
If the former, the correct wording should be:
if (a== 10) {
printf ("TEN");
}else{
printf ("Not TEN");
}
A= 100;
If the latter, the correct wording should be:
if (a== 10) {
printf ("TEN");
}else{
printf ("Not TEN");
A = 100;
}
Of course, this is only a small problem for the C/c++/java compiler, and will not cause the compiler to fail. The compiler is actually inclined to the former, and it automatically handles the first case. But it warns you that this is a bad code style, you can use #pragma clang diagnostic ignored "-WSWITCH" macro to ignore the warning, or set the compile options missingbraces and parentheses to NO.
62. The ipad simulator does not display the Home button
starting with Xcode 4.3, the IPad emulator does not display the Home key for greater user free space. Can you use the menu "Hardware > Home" or shortcut?? H to replace the Home key.
63. Novisible @interface for ' Nsurl ' declares the selector ' query '
IOS6, this method is discarded, please replace it with Nsurl+parameters.
64, certificateidentity ' iphone distribution ' appears more than once
This is a duplicate certificate error, you need to delete the duplicate certificate in the keychain compiled to pass. However, if you restart Xcode, you will find that the previously deleted certificate is back. However, when you restart Xcode, the certificate in Xcode is entered into the keychain, so it is not valid to simply delete the duplicate certificate in the keychain.
It is believed that many students abhor this Bug of Xcode, but there is no other way than to remove the certificate repeatedly (but in vain) from the keychain. In fact, you can not just blame Xcode, but with the "IPhone Configuration using the tool" also has a certain relationship.
These "residue" certificates in Xcode do not exist in the usual form. If you have the IPhone Configuration Utility installed, these certificates actually exist in the. app file in the/users/km-cn/library/mobiledevice/applications/directory, and these. Apps are actually " iphone Configuration Utility--the app that you imported in the app. You can use finder--"show Package Contents" To view the. App. One of the files called "Embedded.mobileprovision" is a duplicate certificate of "residue". You can delete each of these. Apps, or simply remove all of the. Apps from that directory (anyway, you can compile them whenever the project files are present) and import them into the IPhone configuration utility. Finally, you will also remove the duplicate certificate from the Orgnizer and then restart Xcode.
65, Application Identifier ' com. ydtf.* ' which doesn ' t match the current setting ' COM.YDTF.DLT '
As you can see, these two application IDs are absolutely matched (* denotes wildcards). But this inexplicable error can cause you to never compile. This is definitely another Bug for Xcode, first modify CodeSigning to Don ' t Code sign,build, and then modify back to the correct signature Build.
66, Theidentity used to sign the executable is no longer valid.
cannot be archive because of a previous signature issue. Solution See question 65.
67. Set the size of the pop-up window using Presentmodalviewcontroller in ipad
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 doing this Afterpresentmodalviewcontroller
TestVC.view.superview.center = Self.view.center;
Note://it ' simportant to does this after Presentmodalviewcontroller. Be sure to set the frame size after [SELFPRESENTMODALVIEWCONTROLLER:TESTVC Animated:yes];
68. Customize the Actionsheet button and PopOver arrow direction in ipad.
The Actionsheet is displayed on the IPad in a popover way. By default, CancelButton is not displayed (the SDK uses an area other than popover instead of CancelButton, and the user clicks the Cancel button just by clicking the area outside of the popover). If you do this init a actionsheet:
uiactionsheet* sheet=[[uiactionsheet alloc]initwithtitle:Nil
delegate: Self
cancelbuttontitle:@ "Cancel"
destructivebuttontitle:@ "OK"
otherbuttontitles:nil];
Then only the red Destructivebutton will be shown.
If you want to display CancelButton, you can do this:
uiactionsheet* sheet=[[uiactionsheet alloc]initwithtitle:Nil
delegate: Self
cancelbuttontitle:Nil
destructivebuttontitle:Nil
otherbuttontitles:@ "Cancel",@ "OK",Nil];
sheet.cancelbuttonindex=0;
Sheet. Destructivebuttonindex= 1;
When Destructivebuttonindex is specified, the button is displayed in red.
Do not specify Cancelbuttonindex, however, because CancelButton will be removed from the ipad.
In the ipad, the SDK does not provide an API that can modify the arrow direction of the Actionsheet, and the system automatically determines the direction of the arrow display. But we can use the 1th parameter of Showfromrect to change the direction of the arrows:
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];
This replaces the original left arrow with the UP arrow.
In fact, iOS in determining the direction of Actionsheet pop-up logic is very simple, which side has "enough" space, it will pop up. When we use the 1th parameter of Showfromrect to "block" all 3 directions, it will only be able to honestly eject from the direction we want.
69, Setshowaccurateprogress=yes does not work in Asinetworkqueue
Add request.showaccurateprogress= Yes before networkqueue.showaccurateprogress= Yes, otherwise showaccurateprogress will not take effect. Example 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 progress of its upload/download cannot be tracked for data less than 128K.
70, how to set the UIWebView background color for transparent?
Setting UIWebView's Background property in IB is clear Color and does not make its background transparent. To achieve this, you need to use the following two sentences:
[WebView Setbackgroundcolor:[uicolor Clearcolor];
[WebView Setopaque:no];
IOS Development Hundred Questions (6)