LoginSignup
32
31

More than 5 years have passed since last update.

LINEで送るをiOS9でやるには

Last updated at Posted at 2015-09-21

起動時に出る謎のエラー

iOS9ではSchemeを使った実装方法が変わったらしいです。

XCode7にして、実機はiOS9に変更していろいろと触っていると、起動時によくわからないエラーが出ました。スクリーンショット 2015-09-21 22.43.24.png

先人の方々が言うにはplistでLSApplicationQueriesSchemesを追加するように!とのこと。
これで謎のKindleエラーが消えました。

スクリーンショット 2015-09-21 22.44.12.png

本題のLINEで送る

何も気にせずLINEで送るようのコードをSwiftで書いてたんですが、実際に動かしてみると・・・う、動かない。。。

@IBAction func pushLine(sender: AnyObject) {
    let text: String! = "Message!!"
    let encodeMessage: String! = text.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())
    let messageURL: NSURL! = NSURL( string: "line://msg/text/" + encodeMessage )        
    if (UIApplication.sharedApplication().canOpenURL(messageURL)) {
        UIApplication.sharedApplication().openURL( messageURL )
    }
}

Kindleと同じようにlineLSApplicationQueriesSchemesに追加してあげればいいんだな!

スクリーンショット 2015-09-21 22.38.58.png

これでいけましたー!以上ですー。

32
31
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32
31