Upgrade to Pro — share decks privately, control downloads, hide ads and more …

魅せるデバッグ技術

 魅せるデバッグ技術

iOSDC Reject Conference days2

Toshihiro Morimoto

August 31, 2016
Tweet

More Decks by Toshihiro Morimoto

Other Decks in Technology

Transcript

  1. cache ͯͨ͠ը૾͕͓͔͍͠ʁ (lldb) po let $URL = NSURL(string: “http://~”) (lldb)

    po let $request = NSURLRequest(URL: $URL) (lldb) po let $data = NSURLCache.sharedURLCache(). cachedResponseForRequest(request)!. data (lldb) po let $path = “/Users/dealforest/cache.png” (lldb) po $data.writeToFile($path, atomically: true)
  2. SDWebImage, Kingfisher ͳͲͷ͍ͤʁ // Kingfisher ͷ৔߹ (lldb) po let $URL

    = NSURL(string: “http://~”) (lldb) po let $resource = Resource(downloadURL: $URL) (lldb) po let $cache = KingfisherManager.sharedManager.cache // memory (lldb) po let $image = $cache.retrieveImageInMemoryCacheForKey($resource.cacheKey) // disk (lldb) po let $image = $cache.retrieveImageInDiskCacheForKey($resource.cacheKey) (lldb) po let $data = UIImagePNGRepresentation($image)! (lldb) po $data.writeToFile(<path>, atomically: true)
  3. analyse_image // ΦϦδφϧը૾Λϒϥ΢βͰ։͖ // ֤ cache ͷը૾Λग़ྗ͠ Preview Ͱදࣔ͢ΔίϚϯυ (lldb)

    analyse_image “http://~” [original] browser open [request] ok [cache] ok -> “<path_to>/cache.png” [Kingfisher] memory ok -> “<path_to>/kingfisher_memory.png” [Kingfisher] disk ok -> “<path_to>/kingfisher_disk.png”
  4. LLDB Plugin ʹ͢ΔϝϦοτ • σόοά࣌ʹ debug, release Ϗϧυ͕Ͳ͏͔͸ɹɹ ؔ܎ͳ͍ (#ifdef

    DEBUG ϚΫϩͷढ͍) • ϓϩδΣΫτ͕มΘͬͯ΋ಉ͡؀ڥͰσόοάͰ͖Δ • debug ༻ͷίʔυΛຒΊࠐΉඞཁ͕ͳ͍ • debug ͷҝʹ private method Λݺͼग़͍ͯ͠ΔͷΛ ϦϦʔεϏϧυʹؚΉ৺഑͕ͳ͍
  5. ͜Μͳ Plugin ͭ͘Ε͹ศརͰ͢ • ҰఆִؒͰදࣔ͞Ε͍ͯΔ view શͯʹରͯ͠ exerciseAmbiguityInLayout Λ࣮ߦ͢ΔίϚϯυɹɹ (ambigurous

    layout ରࡦ) • ࣮ػͷϑΝΠϧΛ slack ʹૹ৴͢ΔίϚϯυɹɹɹɹ https://gist.github.com/dealforest/702a848ba0a7a64b139985f5cad885f0 • ݱࡏͷ୺຤ͷঢ়گΛදࣔ͢ΔίϚϯυɹɹɹɹɹɹɹɹɹ free diskɺfree memory, ωοτϫʔΫ઀ଓઌ, ɹɹ OS όʔδϣϯͳͲ