投稿

ラベル(iOS)が付いた投稿を表示しています

iOSアプリが突然アップロードできなくなった時の対応(Missing iOS Distribution signing identity for xxxxx)

先日(2/15)iTunesStoreにアプリをアップロードしようとすると以下のエラーが出力され、アップロードできなくなったので、対応内容をメモ。 【エラー内容】 Missing iOS Distribution signing identity for xxxxx 【対応】 1.  以下の証明書をインストール   https://developer.apple.com/certificationauthority/AppleWWDRCA.cer 2. Xcodeを再起動したり、クリーンしたりしてアーカイブ 3. iTunesにアップロード 【参考】 http://stackoverflow.com/questions/32821189/xcode-7-error-missing-ios-distribution-signing-identity-for/35406327#35406327

HealKit HKObjectType 一覧

イメージ
 iOS8からHealthKitが使用できるようになりました。このHealthKit使用することで様々なヘルスデータを管理できます。これらのデータへアクセスする場合、アプリ内で各データへのアクセスをユーザーに確認しなければなりません。確認するには以下のメソッドを使用するのですが、アクセスするデータのタイプがわかりにくかったので一覧にまとめてみました。 ※確認を行った端末はiOS8.2になります。 HealthKitデータへのアクセス確認メソッド - (void)requestAuthorizationToShareTypes:(NSSet *)typesToShare readTypes:(NSSet *)typesToRead completion:(void (^)(BOOL success, NSError *error))completion; HealthKitデータへのアクセス確認画面 HealthKitデータタイプ一覧 QuantityTypeIdentifier 表示名 HKQuantityTypeIdentifierBodyMassIndex ボディマス指数(BMI) HKQuantityTypeIdentifierBodyFatPercentage 体脂肪率 HKQuantityTypeIdentifierHeight 身長 HKQuantityTypeIdentifierBodyMass 体重 HKQuantityTypeIdentifierLeanBodyMass 除脂肪体重 HKQuantityTypeIdentifierStepCount 歩数 HKQuantityTypeIdentifierDistanceWalkingRunning ウォーキング+ランニング HKQuantityTypeIdentifierDistanceCycling 自転車の走行距離 HKQuantityTypeIdentifierBasalEnergyBurned 基礎代謝量 HKQuantityTypeIdentifierActiveEnergyBurned アクティブカロリー HKQuantity...

Undefined symbols for architecture arm64

イメージ
cocoapodsを久しぶりに使用したら以下のエラーが出た。 Undefined symbols for architecture arm64:   "_OBJC_CLASS_$_AFHTTPResponseSerializer", referenced from:       objc-class-ref in xxxxxxxxxxx.o うーん。 どうやらPodsで作成されたライブラリ(.a)とアプリとで、『Architecture』違うぞって言われてる模様。 試行錯誤した結果、BuildSetting -> Architecture の『Standard architectures ( including 64-bit) (armv7,armv7s,arm64)』を『Standard architectures (armv7,armv7s)』に変更するするとビルドエラーを回避できました。 ※ 上記では、アプリ側のArchitectureを変更していますが、逆にPodsプロジェクトのArchitectureにarm64を追加することでもビルドエラーを回避することができます。

【Xcode5】 run script の追加方法

イメージ
Xcode5から『Run Script』の追加方法が変更になったようです。 個人的に少しテンパったので手順を残しておきます。 ① まず、『Add Target...』を選択します。 ② 『Aggregate』を選択し、Target名を指定します。 ③ 『Build Phases』タグを選択します。 ④ メニューのEditaor > Add Build Phase > Add Run Scropt Build Phaseを選択します。 ⑤ Run Scriptが作成されます。

appledocの導入方法

イメージ
 何度か使用しているappledocなのですが、毎回導入手順等の記録を疎かにしてしまうので、ここらで私なりの手順まとめてみようと思います。  1.そもそもappledocって何?  appledocを使用すると、ソースコードのコメントからAPIドキュメントを自動生成することができます。Apple社のリファレンスに似せたドキュメントが生成されるため、iOS等の技術者に取っ付きやすいフォーマットで出力されます。JavadocのObjective-c版という感じでしょうか。   2.導入手順  2-1.appledocのインストール  いろいろ手順はあるのですが、今回はGithubからソース取得&コンパイルしてみます。 ソースのダウンロード  git clone git://github.com/tomaz/appledoc.git ダウンロードできたらコンパイルします。  shdo sh install-appledoc.sh これでappledocコマンドが実行出来ます。  2-2.Xcodeからappledocを使用する  ターミナルからもappledocを使用できるのですが、コードを修正する度(APIリファレンスを作成する度)にコマンドを叩くのは若干手間がかかります。ですので、Xcodeから実行出来るようにしてみます。  まず、プロジェクトを選択し、画面下のAddTargetを選択してAggregateを作成します。すると作成したTarget(Scheme)が追加されます。  追加したTargetを選択し、画面右下の『Add Build Phase』の『Add Run Script』を選択します。 Run Scriptに以下のScriptを入力します。(Ctr+zの戻るコマンドは使えないので注意!!) appledoc --project-name [プロジェクト名] --project-company [会社名] --company-id [会社のID] --create-html --no-create-docset --output  [アウトプット先]  [ソースコード場所] 以上...

クラッシュ時のスタックトレース取得方法

iOS開発において、クラッシュした場所の検討がつかない場合がありました。 いろいろ調べてみると、NSSetUncaughtExceptionHandlerにハンドラ関数のポインタを渡すと、クラッシュ時のスタックトレースが取得できるようです。 以下のコードはその実装例。 @implementation AppDelegate void exceptionHandler(NSException *exception) { NSLog(@"Exception: %@", exception); NSLog(@"Stack Trace: %@", [exception callStackSymbols]); } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSSetUncaughtExceptionHandler(&exceptionHandler); return YES; } @end 以下のコードで無理やりExceptionを発生してみました。 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSSetUncaughtExceptionHandler(&exceptionHandler); //無理やりEcxeptionを発生させる。 NSArray *array = [NSArray array]; [array objectAtIndex:1]; return YES; } 出力結果は以下。 2013-07-15 19:21:45.415 ExceptionSample[27437:c07] Exception: *** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds for empty array ...

UITableViewCell の アニメーション

イメージ
どうやら、UITableViewCellを追加、削除、refreshするときのアニメーションがデフォルトで用意されている模様。 指定出来るアニメーションは以下の通り。 typedef NS_ENUM(NSInteger, UITableViewRowAnimation) { UITableViewRowAnimationFade, UITableViewRowAnimationRight, UITableViewRowAnimationLeft, UITableViewRowAnimationTop, UITableViewRowAnimationBottom, UITableViewRowAnimationNone, UITableViewRowAnimationMiddle, UITableViewRowAnimationAutomatic = 100 }; (例) リロードする場合は、UITableViewControllerのサブクラス内で、 - (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; を以下の様に使用すればOK。 [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic]; 復習も兼ねて、全てのAnimationを確認するためのサンプルコードを作成した。 サンプルコード https://github.com/AlginPlus/TableCellAnimationSample

UITableViewCellの背景色を変更する

UITableViewの背景色を変更しようと以下のDataSourceでcellの背景色を変更しても上手くいかなかった。 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; cell.backgroundColor = [UIColor hogeColor]; return cell; } 背景色を変更するためには以下のDelegate内で指定すると上手くいくらしい… - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { cell.backgroundColor = [UIColor hogeColor]; } とりあえず、よく間違えるのでメモ…

UIAvtionSheetのキャンセルボタンが効かない?

ツールバーがあるとActionSheetのキャンセルボタンの下半分がきかない。 変更前 UIActionSheet *actionSheet = [[UIActionSheet alloc] init]; actionSheet.title = @"タイトル"; [actionSheet addButtonWithTitle:@"決定"]; [actionSheet addButtonWithTitle:@"キャンセル"]; actionSheet.cancelButtonIndex = 1; actionSheet.destructiveButtonIndex = 0; actionSheet.delegate = self; [actionSheet showInView:self.view]; 変更後 UIActionSheet *actionSheet = [[UIActionSheet alloc] init]; actionSheet.title = @"タイトル"; [actionSheet addButtonWithTitle:@"決定"]; [actionSheet addButtonWithTitle:@"キャンセル"]; actionSheet.cancelButtonIndex = 1; actionSheet.destructiveButtonIndex = 0; actionSheet.delegate = self; [sheet showInView:self.view.window];

UIAlertViewをカスタマイズするには

イメージ
UIAlertViewのカスタマイズにつまずいたのでメモ。 通常UIAlertViewを表示したい場合、以下のようなコードを作成する...と思う。 UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"タイトル" message:@"メッセージ" delegate:self cancelButtonTitle:@"キャンセル" otherButtonTitles:@"決定", nil] autorelease]; [alert show]; サイズを変更したかったので、showメソッドの前でframeを変更する。 が、考慮されない模様。 UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"タイトル" message:@"メッセージ" delegate:self cancelButtonTitle:@"キャンセル" otherButtonTitles:@"決定", nil] autorelease]; alert.frame = CGRectMake(0,0,150,150);//サイズ変更が考慮されない [alert show]; どうやら[alert show]した後でないとカスタマイズできない。 なので、以下のようにUIAlertViewDelegateの- (void)willPresentAlertView:(UIAlertView *)alertViewの中でalertViewのサイズを変更する。 -(void)willPresentAlertView:(UIAlertView *)alertView{ CGRect alertFrame = CGRectMake(0,0,320,360); alertView.frame = alertFrame; } 当然ながらサイズを変更するとボタンの位置も変更したくなるので、以下のコードで無理...