カテゴリー : iOS

[iOS] duplicate symbols : libGoogleAnalytics.a と libGoogleAnalytics_debug.a は共存できない

Xcode iOS プロジェクトをビルドしたら、下記のようなエラーが発生しました。

duplicate symbol _OBJC_METACLASS_$_GAIDispatcher in:
    /Users/your_username/git/MyApp/Externals/GoogleAnalytics/libGoogleAnalytics_debug.a(GAIDispatcher.o)
    /Users/your_username/git/MyApp/Externals/GoogleAnalytics/libGoogleAnalytics.a(GAIDispatcher.o)
ld: 212 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

■ 解決方法

[TARGETS] → [Build Phases] → [Link Binary With Libraries] にて、libGoogleAnalytics_debug.a と libGoogleAnalytics.a のどちらかの Link を除去すればOKです。

ファイル名の通り、 libGoogleAnalytics_debug.a はデバッグ時に利用するライブラリなので、本番用ライブラリ libGoogleAnalytics.a と共存させようとしたせいでエラーが発生してしまってたみたいです。

参考情報

[iOS] 画像非同期取得 + キャッシュのライブラリ「SDWebImage」

Facebook の iPhone アプリでも使われている画像非同期取得 + キャッシュのライブラリ「SDWebImage」の使い方をメモ。

rs/SDWebImage · GitHub

SDWebImage を使っているアプリの一覧:Who Use SDWebImage

Facebook の iOS アプリで使われているというだけで安心感がありますね。

SDWebImageによる画像表示とキャッシュ – Cyber Passion for iOS

【iOS】SDWebImageでアプリ容量がどんどん増えていく件 | ht6030

SDWebImageを初めて使う際の注意点 | masaplabs

[iOS] Parse.com を使った Push 通知機能の実装方法

Parse.com を使って iOS アプリに Push 通知機能を実装したので参考になったリンクをメモ。

手順は主に下記の2つのページを参考にしました。

Quick Start | Parse

iOS Push Notifications | Parse

他にも、iOS向けのサンプルアプリやサンプルコードは下記にまとまってます。

Parse Tutorials | Parse

[iOS] ライブラリ管理ツール「CocoaPods」の使い方

MacアプリやiOSアプリ開発で使えるライブラリ管理ツール「CocoaPods」をインストールしました。

% gem install cocoapods
% pod setup
Setting up CocoaPods master repo
Setup completed (read-only access)
% pod --help
CocoaPods, the Objective-C library package manager.
 
Commands:
 
    * install    Install project dependencies
    * ipc        Inter-process communication
    * list       List pods
    * outdated   Show outdated project dependencies
    * push       Push new specifications to a spec-repo
    * repo       Manage spec-repositories
    * search     Search pods
    * setup      Setup the CocoaPods environment
    * spec       Manage pod specs
    * update     Update outdated project dependencies
 
Options:
 
    --silent     Show nothing
    --version    Show the version of CocoaPods
    --no-color   Show output without color
    --verbose    Show more debugging information
    --help       Show help banner of specified command

■ エラー対応

[!] The platform of the target `Pods` (iOS 4.3) is not compatible with

対応するiOSのバージョンを Podfile に指定すればOK

Podfile

platform :ios, '5.0'

■ .gitignore に追加する項目

Pods/
MyPorjectName.xcworkspace

■ Pods は別途、ビルドして libPods.a ファイルを作成する必要がある

ビルドしないと libPods.a ファイルが見つからないエラーが発生してしまう。

ld: library not found for -lPods

Pods をビルドして libPods.a の作成するまでは、下記のサイトがとても分かりやすく参考になった。

CocoaPodsを使ったXcodeプロジェクトの作り方(1) – shigeki.takeguchi.log

CocoaPodsを使ったXcodeプロジェクトの作り方(2) – shigeki.takeguchi.log

CocoaPodsを使ったXcodeプロジェクトの作り方(3) – shigeki.takeguchi.log

CocoaPodsを使ったXcodeプロジェクトの作り方(4) – shigeki.takeguchi.log

[参考]

CocoaPods: The Objective-C Library Manager

CocoaPods ではじめる Objective-C ライブラリ管理 (1) – Watsonのメモ

CocoaPodsでPodの利用&作成のメモ #Objective-C #CocoaPods – Qiita [キータ]

[iOS] xcode cannot run using the selected device – No provisioned iOS devices are available with a compatible iOS version. Connect an iOS device with a recent enough version of iOS to run your application or choose an iOS simulator as the destination.

Xcode でアプリを iPhone へ実機転送しようとしたらエラーが発生して、転送できませんでした。

■ エラー内容

Xcode cannot run using the selected device.

No provisioned iOS devices are available with a compatible iOS version. Connect an iOS device with a recent enough version of iOS to run your application or choose an iOS simulator as the destination.

■ 解決方法

  1. Organize を開く
  2. 左メニューの実機転送したい端末(iPhoneなど)をクリック
  3. 「Use for Development」ボタンをクリック

[参考]

ブランク復帰エンジニアの開発メモ No provisioned iOS devices are available with a compatible iOS version. Connect an iOS device with a recent enough version of iOS to run your application or choose an iOS simulator as the destination.

[Objective-C][iOS] TabBar(タブバー)の実装方法

iPhone/iPadアプリ開発で、TabBar(タブバー)の実装方法を調べたのでメモ。

この辺を読む。

xcode4.2でStorybordを使わずにtabBarControllerにnavigationControllerを追加する方法 – tmplog はてなブックマーク - xcode4.2でStorybordを使わずにtabBarControllerにnavigationControllerを追加する方法 - tmplog

Bugle Diary: [Objective-C][iPhone sdk]tabbarの実装 はてなブックマーク - Bugle Diary: [Objective-C][iPhone sdk]tabbarの実装

頭と尻尾はくれてやる! タブ+ナビゲーションでタイトルとアイコンの設定 はてなブックマーク - 頭と尻尾はくれてやる! タブ+ナビゲーションでタイトルとアイコンの設定

UITabBarController – iPhoneアプリ開発の虎の巻 はてなブックマーク - UITabBarController - iPhoneアプリ開発の虎の巻

UINavigationController – iPhoneアプリ開発の虎の巻 はてなブックマーク - UINavigationController - iPhoneアプリ開発の虎の巻

以上です。

[Objective-C][iOS] unable to dequeue a cell with identifier Cell – must register a nib or a class for the identifier or connect a prototype cell in a storyboar

iOSアプリ開発にて、UITableView でエラー発生。

■ エラーメッセージ

Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘unable to dequeue a cell with identifier Cell – must register a nib or a class for the identifier or connect a prototype cell in a storyboard’

■ 解決方法

indexPathに対応するCellのUIが取得できないので、indexPath指定せずに、後で値を取得するように修正すればOKです。

//    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; //これだと実行時エラー
 
    static NSString *CellIdentifier = @"Cell";
 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

【参考】:UITableView dequeueReusableCellWithIdentifier:forIndexPath: でのアサーション #iOS #Objective-C – Qiita はてなブックマーク - UITableView dequeueReusableCellWithIdentifier:forIndexPath: でのアサーション #iOS #Objective-C - Qiita

[iOS] Facebook や Path のようなスライドメニューを実装するライブラリ「IIViewDeckController」

iOS にて、Facebook や Path のようなスライドメニューを実装するライブラリ「IIViewDeckController」が便利そうなのでメモ。

Inferis/ViewDeck はてなブックマーク - Inferis/ViewDeck

Path や Facebook ライクなスライドメニューを実現するライブラリ “IIViewDeckController” – Over&Out その後 はてなブックマーク - Path や Facebook ライクなスライドメニューを実現するライブラリ

Path や Facebook ライクなスライドメニューを実現するライブラリ7種を比較! – Over&Out その後 はてなブックマーク - Path や Facebook ライクなスライドメニューを実現するライブラリ7種を比較! - Over&Out その後

以上です。

iPhone・Androidアプリのアプリストア分析サービスまとめ

iOS(iPhone/iPad)やAndroidアプリのアプリストア分析サービスをまとめてみました。

App Annie – App Ranking, Analytics, Market Intelligence はてなブックマーク - App Annie - App Ranking, Analytics, Market Intelligence

Mobile Apps Installation, Download & Conversion Tracking | AppsFlyer はてなブックマーク - Mobile Apps Installation, Download & Conversion Tracking | AppsFlyer

We Know Apps | App Analytics, Conversion Tracking & Market Data | Distimo はてなブックマーク - We Know Apps | App Analytics, Conversion Tracking & Market Data | Distimo

APPlyzer.com – App Store Ranking ….. はてなブックマーク - APPlyzer.com - App Store Ranking .....

以上です。

[Xcode] iPhoneアプリ開発で役立つ .gitignore の設定

iPhoneアプリ開発で役立つ .gitignore の設定と題しまして、Stack Overflow からの盛大なるコピペです。

Git ignore file for Xcode projects – Stack Overflow はてなブックマーク - Git ignore file for Xcode projects - Stack Overflow

# Mac OS X
.DS_Store
 
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
 
# Generated files
*.o
*.pyc
 
# Python modules
MANIFEST
dist/
build/
 
# Backup files
*.swp
*~.nib
 
# CocoaPods
Pods/*

これで勝つる!