7, iOS common problems

[pictures uploaded]… (1) the new variable reported syntax errors in the]######1 and switch statement case?

Enclose the code blocks in case x: using {}}.

2, the real machine debugging error

There is no mirror file for the corresponding system version. No connection is allowed. The phone does not trust the computer

3, the introduction of Baidu maps grammar errors

Modify the file suffix called.Mm

4, EXC_BAD_ACCESS this mistake

The main reason is that the program to access the memory address error, according to the back of the judgment, is empty address or a released object address, specific conditions have opened up SIGSEGV access memory or memory is already released SIGPIPE on one end closed socket call write two times, second times the default end process SIGABRT program termination assertions or operating system internal throw

4, product archive invalid, not optional

Don’t choose Device or choose Generic simulator, iOS prototype

5, the project can not choose simulator

The target compiled version is too high, modified in PROJEC -> General -> DeploymentTarget

6, the execution of PresentViewController is slower than normal

Because the current thread can be dormant, so the following statement aroused the main thread (dontSleep)
[self performSelectorOnMainThread:@selector withObject:nil waitUntilDone:NO]; / / empty operation, in order to awaken the main thread

7, add layout constraints, you can not accurately access the view frame

Call layoutIfNeeded at the superview where the layout is located, and then get the frame that constrains the view

8, tabview and Scrollview sliding gesture conflict

– (BOOL) gestureRecognizerShouldBegin: (UIGestureRecognizer *) gestureRecognizer{if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {CGPoint translation = [(UIPanGestureRecognizer *) gestureRecognizer translationInView: self]; BOOL res = Fabs (translation.x) > Fabs (translation.y); return res; / / to determine the current moment is sliding down or sliding around return YES}};

The 9 and two views correspond to the same gesture

By default, gesture recognizers two will not also identify their gestures, but you can implement the gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: method in the UIGestureRecognizerDelegate protocol to control it. This method for any of the two gesture recognizers in a block will be another touch call when the event, if it returns YES, then two gesture recognizers can be identified at the same time, if the return is NO, two gesture recognizers does not guarantee that cannot be identified at the same time, because this method is also a gesture recognizer possible return YES. In other words, the two gesture recognizers delegate methods, as long as any one to return to YES, then the two can be identified simultaneously; only two are returned to NO when the mutex is mutually exclusive. By default, the NO is returned.

10, iOS up and down the black side

Launch Screen is also retained in the project. Delete Launch Screen.xib
7, iOS common problems
, change this to Launch Images Source, select Use Asset Catalog

In, some programs are compiled without running The, file, XMPPDemoA, couldn, t, opened, because, you, don, t, have, be, permission,, to, view, it.

CMD + Shift + K, just clear the cache

12, let a part of the view click on the event accordingly

Rewrite – – (BOOL) pointInside: (CGPoint) point withEvent: (UIEvent *) event

13, let a gesture respond to the top View event at the same time, and also respond to the lower view event

Tap.cancelsTouchesInView = NO;

14, ButtonTitle horizontal alignment

Btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;

15, Button click event does not respond

Probably one: not opening userInteractionEnabled, maybe two: the object that binds the click event has been released

16, send a notification response two times

Since the monitor object has been registered two times without removal, the same place will be called two times

17, ScrollView set the contentoffset, followed by display and disappear steps, contentoffset has become 0, 0

Because contentSize is always 0, so when it’s re shown, it’s 0 again,

18, ScrollView’s contentoffset inexplicably become 0, -20

Will Controller automaticallyAdjustsScrollViewInsets = false?

19, set the shadow for View does not appear

Cannot set layer.masksToBounds = YES, you can set clipsToBounds = YES, to set border

20, The, operation, couldn, t, be,, completed. (FBSOpenApplicationErrorDomain, error, 1.)

Edit scheme has an empty environment variable inside

21, preferredStatusbarStyle invalid

In addition to the already understood to remain current ViewController and infoplist View controller-based status bar appearance which is yes, Baidu navigation may be required for this time no
[[UIApplication sharedApplication]setStatusBarStyle: UIStatusBarStyleLightContent]

22, Xcode8 + IOS 10 print incomplete

#ifndef __OPTIMIZE__ / / IOS 10 + Xcode 8 for all #define pNSLog print (…) printf (“/n%s[Line%d]%s/n”, __PRETTY_FUNCTION__, __LINE__, [[NSString stringWithFormat:__VA_ARGS__]UTF8String]); #endif

23, push new interface when stuck, need to click the home key, back to show

Because the gesture is set back

24, the array traversal For in and for (int i; I < i++; count;) difference

The general case is not what problem, but if the for in end of judgment is one of the elements to determine whether to traverse is equal to the last question
if there are two identical elements in the array, and one of them is just the last one is a problem, will be the first to traverse the same the position of the element in the traversal traversal out (this is a pit)

25, uilabel sets numberOfLines = 0 or no line feed

Set adjustFontSizeWithWidth = YES

26, duplicate, symbols, for, architecture

It is possible to repeat the import header file

27, [_titleBtns, makeObjectsPerformSelector:@selector (setSelected:), withObject:@ (NO)]; invalid

This is useful only in the simulator, so that all objects in the array execute the specified method