カテゴリー : iOS

[iOS] Your Info.plist contains the UINewsstandIcon sub-property under CFBundleIcons, which is intended for use with Newstand feature. To include Newsstand features, the Info.plist must include the UINewstandApp=true Info.plist key.

iPhone アプリを Xcode 経由で申請しようとしたら、エラーが発生しました。

エラー内容

The following issues were found during validation

The following issues were found during validation:

Your Info.plist contains the UINewsstandIcon sub-property under CFBundleIcons, which is intended for use with Newstand feature.
To include Newsstand features, the Info.plist must include the UINewstandApp=true Info.plist key.

解決方法

NewstandIcon

ニューススタンド対応にしない場合は、Info.plist ファイルの Icon files (iOS5) の項目の Newsstand Icon の項目を削除すればOKです。

[iOS] エラー「No application records were found.」

Xcode から iOS アプリを iOS App Store へ登録しようとしたらエラーが発生しました。

xcode_Submit to the iOS App Store

xcode_No application records were found

「No application records were found.」というエラーが発生しました。

原因は、「Ready to Upload Binary」ボタンを押してない状態でした。

[iOS] ReleaseビルドでNSLogを出力させない設定方法

iOS アプリで、ReleaseビルドでNSLogを出力させない設定方法

アプリ名-Prefix.pch ファイルに下記を定義すればOKです。

#ifdef DEBUG
#   define NSLog(...) NSLog(__VA_ARGS__)
#else 
#   define NSLog(...)
#endif

ちなみに、DEBUG のON/OFFの切り替えは下記の画像のように「PROJECT > Build Settings > Apple LLVM compiler 4.2 – Preproessing」で設定します。

ios-debug-off

以上です。

[参考]

objective c – Enable and Disable NSLog in DEBUG mode – Stack Overflow

[iOS] UIScrollView や UITableView のスクロール停止・禁止の設定方法

iOS アプリ開発で、UIScrollView や UITableView のスクロール操作を禁止にする設定方法をご紹介します。

iOS Development

続きを読む

[iOS] Facebook エラー:The Facebook server could not fulfill this access request: The app must ask for a basic read permission at install time.

Facebook iOS SDK version 3.5.1 で Facebook 認証を実装したらエラーが発生しました。

エラーログ

error:Error Domain=com.facebook.sdk Code=2
“The operation couldn’t be completed. (com.facebook.sdk error 2.)”
UserInfo=0x1e8b2740 {com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:SystemLoginCancelled, com.facebook.sdk:ErrorInnerErrorKey=Error Domain=com.apple.accounts
Code=7 “The Facebook server could not fulfill this access request: The app must ask for a basic read permission at install time.”
UserInfo=0x1ddf1eb0 {NSLocalizedDescription=
The Facebook server could not fulfill this access request: The app must ask for a basic read permission at install time.
}, com.facebook.sdk:ErrorSessionKey=, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>}

最初、以下のように openActiveSessionWithPublishPermissions で、publish_actions だけ取得しようとしていたのですが「The app must ask for a basic read permission at install time.」というエラーメッセージの通り、まず basic profile information を取得する必要があるそうです。

+ (void)connectWithCompletionHandler:(void(^)(FBSession *session, FBSessionState status, NSError *error))handler {
    NSLog(@"Connection");
    if ([[FBSession activeSession] isOpen]) {
        NSLog(@"Logout");
        [[FBSession activeSession] closeAndClearTokenInformation];
    }
 
    // Request publish permissions
    NSArray *publishPermissions = [NSArray arrayWithObjects:@"publish_actions", nil];
    [FBSession openActiveSessionWithPublishPermissions:publishPermissions
                                       defaultAudience:FBSessionDefaultAudienceFriends
                                          allowLoginUI:YES
                                     completionHandler:handler];
}

なので、下記のように先に openActiveSessionWithReadPermissions を呼び出せばOKです。

+ (void)connectWithCompletionHandler:(void(^)(FBSession *session, FBSessionState status, NSError *error))handler {
    NSLog(@"Connection");
    if ([[FBSession activeSession] isOpen]) {
        NSLog(@"Logout");
        [[FBSession activeSession] closeAndClearTokenInformation];
    }
 
    // Request basic profile information
    // 基本情報で必要なものがある場合、指定する
    // NSArray *readPermissions = [NSArray arrayWithObjects:@"email", @"user_birthday", nil];
    NSArray *readPermissions = nil;
    [FBSession openActiveSessionWithReadPermissions:readPermissions
                                       allowLoginUI:NO
                                  completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
                                      /* handle success + failure in block */
                                  }];
 
    // Request publish permissions
    NSArray *publishPermissions = [NSArray arrayWithObjects:@"publish_actions", nil];
    [FBSession openActiveSessionWithPublishPermissions:publishPermissions
                                       defaultAudience:FBSessionDefaultAudienceFriends
                                          allowLoginUI:YES
                                     completionHandler:handler];
}

[参考]

Facebook iOS SDK3.5で投稿処理を行う際の流れ(その2) – assaulter's diary

[iOS] アプリ名の設定方法

iPhone/iPad アプリの名前を設定する項目をメモ。

iPhoneアプリ開発: アプリの名前に関する設定項目まとめ | 情熱とスキルと市場

[iOS] アプリへ外部フォントを埋め込む方法

iPhone/iPad などの iOS アプリへ外部フォントを埋め込む方法をメモ。

デフォルトで搭載されているFont

iOSに搭載されているフォントを確認できるサイト
iOS Fonts

iOSアプリへ外部フォントを埋め込む方法

iPhoneアプリへの外部フォントの埋め込み | Albatrus Blog

ゆず屋: [フォント] iPhone & iPhoneアプリのフォント

[iOS6] iPhone実機で通信速度を制限する方法

iPhone実機(iOS6)で通信速度を制限する方法をメモ。

iPhone実機(iOS6.x)で通信速度を制限する #iOS #iPhone – Qiita [キータ]

[Xcode][iOS] error: PCH file built from a different branch ((clang-425.0.27)) than the compiler ((clang-425.0.28))

iOS アプリ開発にて、Xcode のバージョンアップ後に下記のようなエラーが発生しました。

エラーメッセージ

error: PCH file built from a different branch ((clang-425.0.27)) than the compiler ((clang-425.0.28))

Clean 後、再 Build すればOKです。

[参考]

エラー:PCH file built from a different branch – アプリ開発のメモ帳

[iOS][Twitter] Social.frameworkを利用したツイートのクライアントアプリ名「via iOS」表記について

iOS アプリ開発で、Social.frameworkを利用した Twitter のツイートのクライアントアプリ名 “via iOS” 表記について、調査したことをまとめます。

まず、”via iOS” の部分については下記のような仕様みたいです。

Social.framework (since iOS6) / Twitter Framework (iOS5) を利用する場合

Social.framework などを利用して、iOS標準機能でツイートした場合、”via iOS” の部分は変更できません。

Release後は、アプリ名と iTunes Store の URL が自動で付与されるみたいです。

開発版やAdHoc版では、”via iOS” という表記のままのようです。

あなたが実際にこれを設定することはできないようです。

https://dev.twitter.com/issues/39 によると、それらはアップルが保有するデータベース内のアプリ名に基づいて、一致しています。すでに同じ名前の登録、Twitterのアプリケーションを持つことはできません。

また、これはAdHocsまたはテストアプリのみ公開アプリで動作するように得ることができないと思われます。

Looks like you can’t actually set this.

According to: https://dev.twitter.com/issues/39 They match based on the app name in Apple’s database. You can’t already have a registered Twitter Application with the same name.

Also, seems that you can’t get this to work with AdHocs or test apps, only published apps.

[引用]:How can I sign tweets containing my custom "via" with the iOS 5 Twitter framework? – Stack Overflow

API を利用する場合

API経由でTwitterにログインして、ツイートする場合、”via iOS” の部分は自由に設定できるようです。

例えば、アプリを iOS だけでなく、Android 版もリリースしている場合、”via xxx”のリンクは iTunes Store の URL ではなく、アプリのランディングページのURLの方を設定しておきたいですよね。

まとめ

■ iOS標準機能でTweet
[メリット]
・端末に設定したTwitterアカウントでそのままツイートできる
(ログインする手間が掛からない)

[デメリット]
・「via xxx」のURLが必ず iTunes Store のURL
・Android ユーザーがアプリをDLしにくい

■ API経由でTweet
[メリット]
・「via xxx」のURLを指定できる

[デメリット]
・初回ツイート時にログインする必要がある

以上です。