UIImageWriteToSavedPhotosAlbum error: использование неразрешенного идентификатора

Я рекомендую использовать View для этого

Сначала вы должны удалить таблицу, которую вы сделали

DROP TABLE IF EXISTS TableC;

Затем создать представление

CREATE VIEW TableC AS (
SELECT * FROM TableA WHERE Name != ''
UNION
SELECT TableA.id, TableB.Name, TableB.Section, TableA.c_status FROM TableA 
INNER JOIN TableB ON TableA.id = TableB.PR_id
);

После создания представления у вас всегда будет TableC обновлено в соответствии с TableA и TableB

SELECT * FROM TableC

Если вы не можете использовать «Просмотр», вы всегда можете вызвать код ниже, прежде чем использовать TableC

DROP TABLE IF EXISTS TableC;
CREATE TABLE TableC AS (
SELECT * FROM TableA WHERE Name != ''
UNION
SELECT TableA.id, TableB.Name, TableB.Section, TableA.c_status FROM TableA 
INNER JOIN TableB ON TableA.id = TableB.PR_id
);

1
задан Lakshmi Narayanan 20 January 2019 в 08:41
поделиться

2 ответа

Переместите этот метод image_new из photoOutput, как показано ниже,

//target function after saving the images
func image_new(_ image:UIImage,didFinishSavingWithError error : Error?,contextInfo : UnsafeRawPointer)
{
    if let error = error
    {
        let ac = UIAlertController(title: "Save Error",message: error.localizedDescription, preferredStyle: .alert)
        ac.addAction(UIAlertAction(title: "Ok", style: .default))
        present(ac,animated: true)
    }
    else
    {
        let ac = UIAlertController(title: "Saved",message: "Your pic has been saved",preferredStyle: .alert)
        ac.addAction(UIAlertAction(title: "Ok", style: .default))
        present(ac,animated: true)

    }
}

func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto 
photo: AVCapturePhoto, error: Error?) 
{
    if let imageData = photo.fileDataRepresentation() 
    {
        image = UIImage(data: imageData)

        //the code added/////////

        //save the images for test and debug
        UIImageWriteToSavedPhotosAlbum(image,self,#selector(image_new(_:didFinishSavingWithError:contextInfo:)),nil)
        //end

        // the code addedd ends /////

        self.images.append(image!)
        //self.images.append((image?.resized(toWidth: 1200))!)
        let seconds = (currentCamera?.exposureDuration.seconds)!
        self.times.append(Float(seconds * seconds))

        self.takenPhoto = true

        if self.images.count >= self.photoCount 
        {
            self.msg.text = ""
            self.stopRunningCaptureSession()
            self.indicator.startAnimating()
        }
    }
}
0
ответ дан Kamran 20 January 2019 в 08:41
поделиться

Вам необходимо внести пару изменений:

Вытащить func image_new(_image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer), чтобы он был членом класса, а не функцией внутри функции.

Измените подпись на func image_new(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) (то есть сделайте первый параметр безымянным)

Сделайте функцию видимой для среды выполнения Objective C: @objc func image_new(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer)

0
ответ дан Gereon 20 January 2019 в 08:41
поделиться
Другие вопросы по тегам:

Похожие вопросы: