Objective-C 非同期処理テンプレート

Objective-Cでよく使用する非同期処理のコードテンプレート。 メインスレッドで非同期処理を実行する dispatch_async(dispatch_get_main_queue(), ^{ // メインスレッドで実行する処理 }); バックグラウンドのスレッドで非同期処理を実行する dispatch_async…

PDFKitでPDFの綴じ方向、見開き時の表紙設定を取得してセットする

PDFKitでPDFの以下の設定を取得し、セットする。 PDFの綴じ方向(右、左) PDFの単ページ、見開き設定および見開き時の表紙設定 どちらもPDFKitでは直接はサポートしていないので、CGPDFDocumentRefから設定を取得して自分でセットする必要がある。 PDFの綴じ…

PDFKitのバグ: PDFDocumentが間違ったセキュリティ権限を返す

XCode 10.3, macOS 10.14で確認。 *iOS上では未確認。 症状 macOSのPDFKitでPDFDocumentインスタンスの以下の値を使用してPDFにセットされているセキュリティ権限を取得すると、正しく取得できない場合がある。 developer.apple.com PDFに印刷権限(低解像度…

CodaDataで"NSMergeConflict for NSManagedObject"エラーが発生する

CoreDataのNSManagedObjectContextインスタンスのsave:を実行した時にNSErrorが以下のエラーを返す。 NSError: code=133020, domain=NSCocoaErrorDomain, userInfo= { conflictList= ( NSMergeConflict (0x28164b080) for NSManagedObject (0x282e0ba70) wit…

XCodeでサポートされていないバージョンのiOSを使用しているデバイスにアプリをインストール&デバッグする

XCode 10ではiOS 13がインストールされているiOSデバイスに対してアプリをインストールしたりデバッグをすることはできない。XCode 11にバージョンをあげられない場合は、以下でXCode 10でもiOS 13のデバイスを扱うことができるようになる。 DeviceSupportフ…

The error "you must first sign the relevant contracts online (1048)" occurred when you upload archive file on XCode Organizer

The error below occurred when you upload archive file on XCode Organizer. you must first sign the relevant contracts online (1048) It say we have to agree with something contract but XCode nothing to show it even we restart XCode. How to r…

The error "error: unable to read property list from file:..." occurred for "Preprocessed-Info.plist" file while XCode building

XCode 10.3 The error below occurred while XCode building when you set YES to Preprocess Info.plist File of "Build Settings". "error: unable to read property list from file:<Preprocessed-Info.plist file path>" error: The operation couldn't be completed. (XCBUtil.PropertyList</preprocessed-info.plist>…