Skip to content

Latest commit

 

History

History

ja

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

EggsBenedict

Build Status Carthage compatible English

EggsBenedict は Swift で Instagram アプリに画像を渡すためのライブラリです。

このライブラリは Instagram ドキュメントに記載されている手順に従います。

Instagram ドキュメント

ユーザーの iOS デバイス上でカスタム URL スキーム instagram:// を開くことができる場合に次の手順を実行します。

  1. JPEG 形式で jpmarthaeggsbenedict という名前と拡張子 .ig または .igo を付けて tmp/ フォルダに書き込みます。
  2. Instagram アプリへコピーするためのメニューを表示します。
  3. 「Instagram にコピー」アイコンをタップすると Instagram アプリが起動してフィルタ画面に遷移します。

画像は640ピクセルの正方形で JPEG 形式が最適だとドキュメントに記載されています。

The image is preloaded and sized appropriately for Instagram. For best results, Instagram prefers opening a JPEG that is 640px by 640px square. If the image is larger, it will be resized dynamically.

- ところでなんで EggsBenedict って名前やねん?

エッグベネディクトが好きだからです😋

必要条件

  • Swift 2.1
  • Xcode 7.2
  • iOS 8.0 以降

Xcodeプロジェクトに EggsBenedict.framework を追加

Carthage (オススメ)

  1. Cartfile を作成し、github "JPMartha/EggsBenedict" ~> 0.9.9 を追記します。
  2. プロジェクトのフォルダで $ carthage update --platform iOS を実行します。
  3. TARGETS の「Build Phases」にある「Link Binary With Libraries」の「+」アイコンをクリックして Carthage/Build フォルダから EggsBenedict.framework を追加します。
  4. TARGETS の「Build Phases」にある「+」アイコンをクリックして「New Run Script Phase」を選択し Run Script に次の内容を入力します。
/usr/local/bin/carthage copy-frameworks

「Input Files」に EggsBenedict.framework のパスを追加します。

$(SRCROOT)/Carthage/Build/iOS/EggsBenedict.framework

このスクリプトは App Store へ提出時のバグ を回避します。

This script works around an App Store submission bug triggered by universal binaries and ensures that necessary bitcode-related files are copied when archiving.

  1. Podfile を作成し、次の内容を入力します。
use_frameworks!
pod 'EggsBenedict', '~> 0.9.9'
  1. プロジェクトのフォルダで $ pod install を実行します。

はじめ方

  1. Xcode プロジェクトの Info.plist に LSApplicationQueriesSchemes キーを追加します。
Key Type Value
LSApplicationQueriesSchemes Array instagram
  1. SharingFlowType 列挙型のタイプを指定して SharingFlow クラスのインスタンスを作成します。
let sharingFlow = SharingFlow(type: .IGOExclusivegram)

詳しくは SharingFlow クラスリファレンス と SharingFlowType 列挙型 を参照してください。

  1. 作成したインスタンスの presentOpenInMenuWithImage:inView: メソッドを呼びます。

詳しくは SharingFlow クラスリファレンス を参照してください。

ドキュメント

ライセンス

EggsBenedict は MIT License の下に提供されています。