[iOS] problems encountered in the development process

Summary of the various problems encountered in the development process, such as understanding errors, please correct me, thank you! Continuous update…

  • From “A” ViewController Push to “B” ViewController animation effects appear Caton.
    ViewController: no reason to set the background color, background color, the default self.view is transparent, because visual Caton problems lead to transparent color overlapping.
    solution: set the background color to “B” ViewController:
    self.view.backgroundColor = [UIColor whiteColor];
  • The automaticallyAdjustsScrollViewInsets controller
    reason: the automaticallyAdjustsScrollViewInsets attribute in the iOS7.0, the default is YES, it will be based on the interface of status bar, search bar, navigation bar, toolbar or, tab bar Scrollview inset to automatically adjust the height.
    solution: set the controller to NO:
    self.automaticallyAdjustsScrollViewInsets = NO;
  • When out of “B” ViewController pop, memory is not released.
    Description: memory does not release for several reasons: 1,
    code by cycle reference;
    2, part of the memory need to manually release; such as NSTimer, CADisplayLink, notification center need to manually release the
    solution: to avoid circular references; manual release to release the release of NSTimer [self.timer code / / invalidate]; self.timer = nil CADisplayLink [self.displayLink invalidate]; / / release; self.displayLink = nil; / / release notification Center (who registered who release) – (void) dealloc NSNotificationCenter defaultCenter] removeObserver:self] {+};
  • Bluetooth development, in the “B” ViewController to create [[CBCentralManager initWithDelegate:self queue:nil]; pop back to “A” ViewController to turn off the Bluetooth program crash problem.
    Description: pop, “B ViewController” release, but it will still turn off Bluetooth calls the centralManagerDidUpdateState: method in the “A” in ViewController, this method has been released into the lead program can not find the method so the program crashes.
    solution: Bluetooth module can be encapsulated into a single class.
  • IOS click on the sub view of the response of the parent view click event
    1, your class inherits the UIGestureRecognizerDelegate
    2, tap.delegate = self;
    3, gestureRecognizer:shouldReceiveTouch: method: //Object-C: – (BOOL) gestureRecognizer: (UIGestureRecognizer * gestureRecognizer) shouldReceiveTouch: (UITouch * touch) {if ([touch.view isDescendantOfView:subView]) {return NO}}; return YES; //Swift: func gestureRecognizer (gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch -> Bool) {if touch.view.isDescendantOfView (subView) {return} false return true}
  • Version (application release version number) and Build (application internal label)
    1, Version corresponds to CFBundleShortVersionString.
    Version is generally determined by the product department, the version number is a string consisting of separated integers, generally have 2 or 3 sections, such as: 1.2, 1.2.3
    two section: first section:
    (majorversion) new functions or different changes of
    second segments: (vice the version number) which contains small function updates will also include bug repair
    three stage:
    the first section: a significant modification of the revised version, such as the realization of new functions or major change.
    second segments: the realization of more prominent features, such as new features to add and repair large problems.
    third segments: represents the maintenance version, fixes bug.
    2, Build (application internal label)
    Bulid is for internal use, and Version will not have much contact.
    Bulid corresponds to CFBundleVersion. To identify the internal version number of (published or unpublished). In order to record the development of the version, each update is required to be higher than the previous.
    role: release build version for the test team for testing. //Object-C NSDictionary *info= [[NSBundle mainBundle] infoDictionary]; info[@ “CFBundleShortVersionString”]; //Version info[@ “CFBundleVersion”]; //Build //Swift let NSBundle.mainBundle (.InfoDictionary) info:NSDictionary! = let version info[= “CFBundleShortVersionString”]; let build info[= “CFBundleVersion”]; “(print / version = (version) / (build) = build.”)
  • The new Xcode playground to find execution error: Unable service for selected run destination
    solution: close Xcode, performed in the terminal two line of code RM -rf ~/Library/Developer/CoreSimulator/Devices killall -9 com.apple.CoreSimulator.CoreSimulatorService [iOS] problems encountered in the development process