0
私のコードに問題があります。self.navigationController.pushViewController
機能が無限と呼ばれています。コードが添付されています。バーコードを読み取って製品情報を取得しています。ナビゲーションコントローラshow/push viewcontroller swift
詳細:詳細: 詳細: 詳細:詳細:
func captureOutput(captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [AnyObject]!, fromConnection connection: AVCaptureConnection!) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let nav = storyboard.instantiateViewControllerWithIdentifier("companyInfoNAv") as! UINavigationController
let companyInfoView = nav.topViewController as! CompanyInformationViewController // toggleFlash()
for meta_Data in metadataObjects {
let decoded_data: AVMetadataMachineReadableCodeObject = meta_Data as! AVMetadataMachineReadableCodeObject
self.output_Label.text = decoded_data.stringValue
self.reader_Type.text = decoded_data.type
let manager: AFHTTPSessionManager = AFHTTPSessionManager.init()
manager.GET("https://api.outpan.com/v2/products/"+decoded_data.stringValue+"?apikey="+"944b2810f5072d9d125f5fcf32543r1", parameters: nil, success: { (NSURLSessionDataTask, responseObject) in
self.arrayObjects = responseObject as! NSDictionary
print(self.arrayObjects)
if((self.arrayObjects.objectForKey("name")?.empty) == nil){
let attributes : NSDictionary!
attributes = self.arrayObjects.objectForKey("attributes") as! NSDictionary
if(attributes.count > 3){
if(attributes.objectForKey("Manufacturer")?.empty == nil){
companyInfoView.companyName = attributes.objectForKey("Manufacturer") as! NSString as String
}
}else{
companyInfoView.companyName = "No Name in DATABASE"
}
}
else{
companyInfoView.companyName = "No Name in DATABASE"
}
print(self.arrayObjects.objectForKey("name"))
}, failure: { (operation, error) in
print(error)
})
}
self.navigationController?.pushViewController(companyInfoView, animated: true)
}
あなたのストーリーボードで、あなたのscannerPageとcompanyInfoViewをリンクしましたか? – Carlo