2017-05-05 11 views
0

私のXcode出力にIMDB JSONリクエストを出力したい。 検索バーにユーザーが書き込むものパルプフィクションのJSONリクエストをIMDBから取得して、Xcode出力に出力したいと思います。IMDB APIのlldbエラー

マイリクエスト:http://www.omdbapi.com/?t=pulp+fiction しかし、それは与え、lldbエラー

Xcodeの出力:

2017年5月5日20:13:12.363263 + 0300 IMDBアピプロジェクト[4327:696994] [MC] systemgroup.com.apple.configurationprofilesのシステムグループコンテナ パスは /Users/gurkan/Library/Developer/CoreSimulator/Devices/7DCF1A18-D92C-45BB-9F89-01EBF200DA41/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationproファイル 2017-05-05 20:13:12.388362 + 0300 IMDB Api Project [4327:696994] [MC] プライベートな有効なユーザー設定からの読み取り。

検索バーにenterをクリックした後。

(lldb)

を次に、この(私はその後、私はちょうど今の検索バーするためにどのようなユーザーの書き込みパルプフィクションのために取得したいので、私はwritedすることは重要ではありません、クリックされた。何かをwrited)スクリーンが入った。

0_swift_bridgeNonVerbatimFromObjectiveC:

libswiftCore.dylib`_swift_bridgeNonVerbatimFromObjectiveC: 
    0x109ebabd0 <+0>: pushq %rbp 
    0x109ebabd1 <+1>: movq %rsp, %rbp 
    0x109ebabd4 <+4>: pushq %r15 
    0x109ebabd6 <+6>: pushq %r14 
    0x109ebabd8 <+8>: pushq %r12 
    0x109ebabda <+10>: pushq %rbx 
    0x109ebabdb <+11>: movq %rdx, %r14 
    0x109ebabde <+14>: movq %rsi, %r12 
    0x109ebabe1 <+17>: movq %rdi, %r15 
    0x109ebabe4 <+20>: callq 0x109ebaed0    ; tryBridgeNonVerbatimFromObjectiveCUniversal(swift::HeapObject*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*) 
    0x109ebabe9 <+25>: testb %al, %al 
    0x109ebabeb <+27>: je  0x109ebabf6    ; <+38> 
    0x109ebabed <+29>: popq %rbx 
    0x109ebabee <+30>: popq %r12 
    0x109ebabf0 <+32>: popq %r14 
    0x109ebabf2 <+34>: popq %r15 
    0x109ebabf4 <+36>: popq %rbp 
    0x109ebabf5 <+37>: retq 
    0x109ebabf6 <+38>: leaq 0x872bb(%rip), %rsi  ; protocol descriptor for Swift._ObjectiveCBridgeable 
    0x109ebabfd <+45>: movq %r12, %rdi 
    0x109ebac00 <+48>: callq 0x109ee6de0    ; swift_conformsToProtocol 
    0x109ebac05 <+53>: movq %rax, %rbx 
    0x109ebac08 <+56>: testq %rbx, %rbx 
    0x109ebac0b <+59>: je  0x109ebac47    ; <+119> 
    0x109ebac0d <+61>: movq %r12, %rdi 
    0x109ebac10 <+64>: movq %rbx, %rsi 
    0x109ebac13 <+67>: callq *(%rbx) 
    0x109ebac15 <+69>: movq %r15, %rdi 
    0x109ebac18 <+72>: movq %rax, %rsi 
    0x109ebac1b <+75>: callq 0x109eb54f0    ; swift_dynamicCastUnknownClass 
    0x109ebac20 <+80>: testq %rax, %rax 
    0x109ebac23 <+83>: je  0x109ebacb2    ; <+226> 
    0x109ebac29 <+89>: movq 0x10(%rbx), %r9 
    0x109ebac2d <+93>: movq %rax, %rdi 
    0x109ebac30 <+96>: movq %r14, %rsi 
    0x109ebac33 <+99>: movq %r12, %rdx 
    0x109ebac36 <+102>: movq %r12, %rcx 
    0x109ebac39 <+105>: movq %rbx, %r8 
    0x109ebac3c <+108>: popq %rbx 
    0x109ebac3d <+109>: popq %r12 
    0x109ebac3f <+111>: popq %r14 
    0x109ebac41 <+113>: popq %r15 
    0x109ebac43 <+115>: popq %rbp 
    0x109ebac44 <+116>: jmpq *%r9 
    0x109ebac47 <+119>: movq (%r12), %rax 
    0x109ebac4b <+123>: xorl %ecx, %ecx 
    0x109ebac4d <+125>: cmpq $0x7ff, %rax    ; imm = 0x7FF 
    0x109ebac53 <+131>: cmoval %ecx, %eax 
    0x109ebac56 <+134>: cmpl $0xf, %eax 
    0x109ebac59 <+137>: je  0x109ebac96    ; <+198> 
    0x109ebac5b <+139>: cmpl $0xd, %eax 
    0x109ebac5e <+142>: jne 0x109ebacb2    ; <+226> 
    0x109ebac60 <+144>: movq 0x8(%r12), %rax 
    0x109ebac65 <+149>: movq (%rax), %rax 
    0x109ebac68 <+152>: xorl %ecx, %ecx 
    0x109ebac6a <+154>: cmpq $0x7ff, %rax    ; imm = 0x7FF 
    0x109ebac70 <+160>: cmoval %ecx, %eax 
    0x109ebac73 <+163>: cmpl $0x80, %eax 
    0x109ebac78 <+168>: ja  0x109ebac91    ; <+193> 
    0x109ebac7a <+170>: leaq 0x766c7(%rip), %rbx  ; protocol witness table for Swift._BridgeableMetatype : Swift._ObjectiveCBridgeable in Swift 
    0x109ebac81 <+177>: leaq 0x3c(%rip), %rcx   ; <+244> 
    0x109ebac88 <+184>: movslq (%rcx,%rax,4), %rax 
    0x109ebac8c <+188>: addq %rcx, %rax 
    0x109ebac8f <+191>: jmpq *%rax 
    0x109ebac91 <+193>: callq 0x109eb6260    ; swift_unreachable(char const*) 
    0x109ebac96 <+198>: movq 0x10(%r12), %rax 
    0x109ebac9b <+203>: testl $0xffffff, %eax   ; imm = 0xFFFFFF 
    0x109ebaca0 <+208>: jne 0x109ebacb2    ; <+226> 
    0x109ebaca2 <+210>: testl %eax, %eax 
    0x109ebaca4 <+212>: js  0x109ebacb2    ; <+226> 
    0x109ebaca6 <+214>: leaq 0x7669b(%rip), %rbx  ; protocol witness table for Swift._BridgeableMetatype : Swift._ObjectiveCBridgeable in Swift 
    0x109ebacad <+221>: jmp 0x109ebac0d    ; <+61> 
    0x109ebacb2 <+226>: leaq 0x4c3c8(%rip), %rax  ; "value type is not bridged to Objective-C" 
    0x109ebacb9 <+233>: movq %rax, 0xb9268(%rip)  ; gCRAnnotations + 8 
    0x109ebacc0 <+240>: int3 
-> 0x109ebacc1 <+241>: nopl (%rax) 

Main.storyboard: https://i.hizliresim.com/M03v57.png

Viewcontroller.swift:結果

// 
// ViewController.swift 
// IMDB Api Project 
// 
// Created by gurkan on 5.05.2017. 
// Copyright © 2017 gurkan. All rights reserved. 
// 

import UIKit 

class ViewController: UIViewController,UISearchBarDelegate { 


    @IBOutlet weak var searchBar: UISearchBar! 

    @IBOutlet weak var imageView: UIImageView! 

    @IBOutlet weak var titleLabel: UILabel! 


    @IBOutlet weak var directorLabel: UILabel! 

    @IBOutlet weak var ratingLabel: UILabel! 

    @IBOutlet weak var actorsLabel: UILabel! 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     // Do any additional setup after loading the view, typically from a nib. 

     searchBar.delegate = self 
    } 

    func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { 

     searchForMovie(title: searchBar.text!) 
     searchBar.text = "" 


    } 

    func searchForMovie(title: String){ 

     //http://www.omdbapi.com/?t=pulp+fiction 
     if let movie = title.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed){ 

      let url = URL(string: "http://www.omdbapi.com/?t=pulp+fiction") 
      let session = URLSession.shared 
      let task = session.dataTask(with: url!, completionHandler: { (data, response, error) in 
       if error != nil { 
        print(error!) 
       } else { 

        if data != nil { 

         do { 

          let jsonResult = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.mutableContainers) as! Dictionary<String,String> 


          DispatchQueue.main.async { 
           print(jsonResult) 
          } 

         } catch { 

         } 

        } 

       } 

      }) 

      task.resume() 

     } 

    } 
} 

、どのように私はこのlldbエラーを解決できますか?パルプフィクションのIMDB JSONリクエストを印刷するにはどうすればよいですか?

Xcodeのバージョン:バージョン8.3.2 シミュレータ:iPhone 6(展開が10.3をターゲット)

https://i.hizliresim.com/r3o2R7.png

答えて

0

あなたはクラッシュの危険を冒す!を使用してスウィフトで何かを "強制" するたびに。また、同時に多くのことが起こっていると、どこが間違っているのか把握するのが難しくなります。

はこのようにそれを試してみてください。

func searchForMovie(title: String) { 

    //http://www.omdbapi.com/?t=pulp+fiction 
    if let movie = title.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) { 

     if let url = URL(string: "https://www.omdbapi.com/?t=pulp+fiction") { 

      let session = URLSession.shared 

      let task = session.dataTask(with: url, completionHandler: { (data, response, error) in 

       if error != nil { 
        print(error!) 
       } else { 

        if let d = data { 

         do { 

          let jsonResult = try JSONSerialization.jsonObject(with: d, options: JSONSerialization.ReadingOptions.mutableContainers) 

          print(jsonResult) 

         } catch { 

         } 

        } 

       } 

      }) 

      task.resume() 

     } 

    } 

} 
+0

はありがとうございました!それは働いている。 –

+0

これはもう無料ではありません これを試してください http://www.theimdbapi.org/ – Chali

関連する問題