Objective-c

  • ,

    dispatch_asyncの内部コードが実行されない時

    dispatch_asyncの内部コードが最後まで実行されず原因を調べた。 原因はsingletone実装の問題があった。 dispatch_asyncで呼ばれたsingletoneオグジェクトが 正しく初期化されないことが原因。 [だめな方法] +(MyClass) shared { static MyClass *_sharedInstance = nil; if(_sharedInstance == nil){ dispatch_once_t onceTokeon; dispatch_once(&onceTokeon, ^{ _sharedInstance = [[MyClass alloc] init]; }); } return _sharedInstance; } [正しい方法] +(MyClass *){ static MyClass *sharedInstance; @synchronized(self) { if (sharedInstance == nil) { sharedInstance = [[MyClass alloc] init]; } } return sharedInstance; } [Apple 推奨] +(MyClass…

    続きを読む

  • ,

    Xcode 6 iOS UILabel font size 自動リサイズ

    XCodeで iPad, iPhoneのサイズ別に fontのサイズを自動調節したい場合 元のネタ: http://stackoverflow.com/questions/30008136/changing-uilabel-font-size-with-autolayout 公式サイト: https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/ChangingtheFontforaSizeClass.html#//apple_ref/doc/uid/TP40014436-CH12-SW1 UILabelのfont設定のところの左にある+ボタンを押して対応 compact width/regular height : iPhone portrait any width/compact height : iPhone Landscape regular width/regular height : iPad portrait

    続きを読む

  • ,

    iPhone ip address 自動更新 airplane モードをCommand lineで実行

    [課題] iPhoneのGlobal ip addressを自動更新 [方針] 1.network deviceを再起動し更新 (成功) 2.airplane modeをprivate apiを利用し on / off (成功) [対策詳細1] Step 1)iPhone Jail break 2)open-ssh install 3)network restartメッソドを実装 4)アプリをルートアプリに昇格 1) iPhone Jail break – 7.1.x – iTunesがインストールされているかを確認すること http://tools4hack.santalab.me/how-to-ios71-ios711-untethered-jailbreak-pangu.html 2)-open-sshインストール cydiaよりインストール 3)network refresh method 3-1)ダメな方法 [参考URL] http://www.sinfuliphone.com/showthread.php?t=2144 network commandをインストールしrefreshする方法はwifiは更新できるが 3G/4G回線は更新できなかった。 3-2)成功した方法 system(“/bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.CommCenter.plist”); system(“/bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.CommCenter.plist”); CommCenter自体をリロードすることでネットワークの更新に成功 4)アプリをルートアプリに昇格…

    続きを読む

  • unityで出力されたiOSプロジェクトのSplash Image

    [現象] unityで出力されたiOSプロジェクトのSplash Imageの指定をLaunch Images Sourceで指定しても8.0以上で治らない件 [原因] 8.0以上ではLaunch Screen Fileの設定がされているとこちらの設定が優先される。 [対策] LaunchScreenImage-Portrait.png LaunchScreenImage-Landscape.png の設定もアップデート

    続きを読む

  • UILabel でテキストが更新されない時。

    [現象] サーバより非同期で取得したデータをLabelのテキストに入れたが きちんと更新が行われない。下記Warningがでる CoreAnimation: warning, deleted thread with uncommitted CATransaction [原因] 非同期で取得したためUIViewのanimationがメインスレッドで実行されないことが原因 [対策] メインスレッドで実行するように指定 [コード] //メインスレッドで実行 dispatch_async(dispatch_get_main_queue(), ^{ // Perform any drawing/UI updates here. self.currentBalance.text = [NSString stringWithFormat:@”%d”,(int) balance]; });

    続きを読む

  • ,

    How to reproduce bugs reported against App Store submissions

    https://developer.apple.com/library/ios/qa/qa1764/_index.html

    続きを読む

  • ,

    UIViewController receive message order

    see http://stackoverflow.com/questions/9539676/uiviewcontroller-returns-invalid-frame {{0, 0}, {768, 1004}} viewDidLoad {{0, 0}, {768, 1004}} shouldAutorotateToInterfaceOrientation: {{0, 0}, {768, 1004}} shouldAutorotateToInterfaceOrientation: {{0, 0}, {768, 1004}} viewWillAppear: {{0, 0}, {768, 1004}} shouldAutorotateToInterfaceOrientation: {{0, 0}, {768, 1004}} shouldAutorotateToInterfaceOrientation: {{0, 0}, {768, 1004}} willRotateToInterfaceOrientation:duration: {{0, 0}, {1024, 748}} viewWillLayoutSubviews {{0, 0}, {1024, 748}} layoutSubviews {{0, 0}, {1024, 748}} viewDidLayoutSubviews {{0, 0}, {1024,…

    続きを読む

  • ,

    iOS PEM CREATE COMMAND

    openssl pkcs12 -in xxx.p12 -out yyy.pem -nodes -clcerts

    続きを読む

  • ,

    Unity Crash with CA::Display::DisplayLinkItem::dispatch()

    解決策のURL http://forum.unity3d.com/threads/203506-Workaround-ios7-DisplayLink-Scrolling-results-in-crash 下記をコメントアウト

    続きを読む

  • , , ,

    nibを探せないとき

    nibファイルを探せないエラーが発生し、iOS7では正常に動作した。 https://github.com/kstenerud/iOS-Universal-Framework/issues/152 resources load in iOS 7 but not iOS 6 No milestone No one is assigned When running in the simulator, I’m adding the embedded framework to a test app. When run under 7.0.3, it runs with no issues. When run under 6.1 or less, it’s crashing with the following: ‘NSInternalInconsistencyException’, reason: ‘Could not…

    続きを読む