2018年2月19日 星期一

Compiler Warning messages


no rule to process file of type net.daringfireball.markdown for architecture x86_64
  1. Select Project Navigator
  2. Select your project
  3. Select your target
  4. Select Build Phases
  5. Move files (in this case, CHANGLELOG.md) that you don't want the compiler to process from Compile Sources to Copy Bundle Resources
     
Property access result unused - getters should not be used for side effects
  1. self.lables.removeLastObject; 方法不要用. 要用[],不然compiler會認為是getter
  2. [self.lables removeLastObject];
Implicit conversion from enumeration type 'SO_LOG_LEVEL' to different enumeration type 'DDLogFlag' (aka 'enum DDLogFlag')
  1.  LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, level, 0, nil, __PRETTY_FUNCTION__, message); 要先轉好型再放進去
  2.  LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, (DDLogFlag)level, 0, nil, __PRETTY_FUNCTION__, message);
Format string is not a string literal (potentially insecure) 
  1. LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, (DDLogFlag)level, 0, nil, __PRETTY_FUNCTION__, message); 參數是是用Format String不是普通String
  2. LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, (DDLogFlag)level, 0, nil, __PRETTY_FUNCTION__, @"%@", message);
  
PerformSelector may cause a leak because its selector is unknown
  1. 因為可能會找不到function所以使用selector可能會有leak,這裡我們直接忽略它 
    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
        [self performSelector: aSelector];
    #pragma clang diagnostic pop
     
warning: Consistency Error: Setting the No Action Delete Rule on EmployeeQueue.child may result in relationships to deleted objects


Fixed width constraints may cause clipping
  1. 這是Localization Issue,Xcode9擔心我們的文字輸入框在固定寛度的情況下,文字過長時會被clip掉,你可以用它推薦的解法,把trailing或leading設為>=或<=現在的寬度,也可以移除這個constrains
  2. 如果是textField你不會想在使用者輸入太長的時候延長它,你可以把width改成依container的寬度比例來work around.

沒有留言:

張貼留言