2013年4月15日月曜日

[Android SDK]デバックモードの判別


[Android SDK]デバックモードの判別

Debug.isDebuggerConnected()

で判定できる。

manifest.xmlで
android:debuggable="true"
とすると。
Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one
とワーニングが出るが、debuggableは自動的に判別するのでmanifest.xmlで設定をする必要がない、
eclipseからの起動でdebug=trueとなり、apkを書きだす時にdebug=falseになる。

2013年3月15日金曜日

[iOS]iOSシミュレーターの格納場所

フォルダパスは
/Users/[User Name]/Library/Application Support/iPhone Simulator/6.1
または
/Library/Application Support/iPhone Simulator/6.1
iOSのバージョンごとにフォルダ分けされている。

Applicationsフォルダ内の
HOGE1234-HO77-HO77-HO77-HOGE123456789
などのフォルダがアプリ格納の場所。

ファイルのアウトプットはDocuments内に格納される。

2013年3月8日金曜日

[iOS]Enumeration values * not handled in switch


Enumeration values * not handled in switch

列挙子*はswitchで処理されていません。
つまりswitchで列挙子をすべて網羅する必要がある。

2013年3月4日月曜日

[iOS]iOS4.3~5.1~6.1に回転対応をする

あらかじめ[appname].plistSupported interface orientationsを設定する必要がある。

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    //iOS 4.3~5.1 回転時の呼び出しメソッドを設定
    
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(orientationChanged:)
                                                 name:UIDeviceOrientationDidChangeNotification
                                               object:nil];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
    //iOS 4.3~5.1 回転の停止
    //他のViewControllerで使用したくないときはここでキャンセルする
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:UIDeviceOrientationDidChangeNotification
                                                  object:nil];
}

//iOS 6.0~ 回転をサポートするか
- (BOOL)shouldAutorotate
{
    return YES;
}

//iOS 6.0~ 推奨される向き
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;
}

//iOS 6.0~ サポートする向き
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

//iOS 4.3~5.1 回転をサポートするか?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

//回転時の動作
- (void)orientationChanged:(NSNotification *)notification
{

}

//回転時のアニメーションを定義
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{

}

//回転前に呼び出される
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{

}

2013年2月19日火曜日

[iOS]This bundle is invalid.

This bundle is invalid. The key CFBundleVersion in the info.plist file must contain a higher version than that of the previously uploaded version.

iTunesConnectに審査提出中にOrganaizerで上記のエラーが発生した。

CFBundleVersionが前のバージョンより新しくしてください、
ってことなんだけど、1.1.0から1.1.1でもちろん新しくなってる。

原因は
plistからBundle versionが抜けていた。

Target>SummaryのVersionって修正してもplistに反映されないのね。

2013年2月18日月曜日

[iOS]NSPersistentStoreCoordinatorでエラー


Coredataを使用中に
persistentStoreCoordinator_ = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
でエラーを吐いた。
persistentStoreCoordinator_
を生成できないらしい。

現象は
http://stackoverflow.com/questions/4199466/core-data-crash-in-initwithmanagedobjectmodel
と同じで、appname.xcdatamodeldのファイルがおかしいらしい

appname.xcdatamodeldがxCode上から開けない状態だったので、
一度xCode上から削除して再度インポートするとエラーは消えた。

他にもxcdatamodeldが前のバージョンと違ってもこのエラーらしいね。

2013年2月8日金曜日

[iOS]iPadのサイズとか

iPhoneサイズ
320x480
640x960
640x1136

ステータスバーを省いたサイズ
320x460
640x620
640x1096

iPad、iPadMiniサイズ
Portrait 768 x 1024
Landscape 1024 x 768

ステータスバーを省いたサイズ
Portrait 768 x 1004
Landscape 1024 x 748


iPad(Retina)サイズ
Portrait 1536 x 2048
Landscape 2048 x 1536

ステータスバーを省いたサイズ
Portrait 1536 x 2008
Landscape 2048 x 1496