gpt4 book ai didi

Swift Failed to associate thumbnails for picked URL file(Swift无法关联所选URL文件的缩略图)

转载 作者:bug小助手 更新时间:2023-10-22 14:29:46 54 4
gpt4 key购买 nike



I would like to understand what this error come from :
The error

我想了解这个错误的来源:


This the error from text :

这是来自文本的错误:



2023-09-07 12:16:50.304646+0200 ML2V_IOS[4697:148814] [DocumentManager] Failed to associate thumbnails for picked URL file:///Users/clement/Library/Developer/CoreSimulator/Devices/0F76A94C-620C-405E-8761-545CC2C583D3/data/Containers/Shared/AppGroup/75D64675-C770-4EED-8CF4-39606A85E838/File%20Provider%20Storage/Facture_gggggg.pdf with the Inbox copy file:///Users/clement/Library/Developer/CoreSimulator/Devices/0F76A94C-620C-405E-8761-545CC2C583D3/data/Containers/Data/Application/1B7A183D-2658-478F-AB87-FCB46C780168/tmp/SMW.ML2V-IOS-Inbox/Facture_gggg.pdf: Error Domain=QLThumbnailErrorDomain Code=102 "(null)" UserInfo={NSUnderlyingError=0x600001927e70 {Error Domain=GSLibraryErrorDomain Code=3 "Generation not found" UserInfo={NSDescription=Generation not found}}}



My goal is to send file and an update to my firestore and my firebase to link the document to my file. Nothing really hard normally but ...
I just finished to build the code but this error show up and nothing seems to be wrong from my code...
This is the following swift code :

我的目标是将文件和更新发送到我的firestore和firebase,以将文档链接到我的文件。正常情况下没有什么困难,但是。。。我刚刚完成了代码的构建,但出现了这个错误,我的代码似乎没有什么问题。。。这是以下swift代码:


//
// UserSolde.swift
// ML2V_IOS
//
// Created by Clément Enjolras on 05/09/2023.
//

import SwiftUI
import FirebaseStorage
import UIKit
import MobileCoreServices

struct UserSolde: View {
@EnvironmentObject var viewModel: AuthViewModel
@StateObject var soldemodel = SoldeModel()
@State private var soldes: [Solde] = []
@State private var isDocumentPickerPresented = false
@State private var selectedURL: URL?
@State private var selectedSoldeID: String? = nil
@State private var selectedSoldeOwner: String? = nil

var body: some View {
content.onAppear{
Task{
do{
try await soldemodel.getAllSolde()
soldes = soldemodel.resultsolde
}catch{
print("Erreur lors de la récupération des soldes : \(error)")
}
}
}
}

var content: some View{
VStack{
HStack{
Text("Mes Soldes").font(.system(size: 24).bold())
Spacer()
Image(systemName: "creditcard")
.font(.system(size: 32))
.foregroundColor(.black)
.frame(width: 32, height: 32)
.background(Color(.white))
}.padding(.horizontal)

List($soldes){ solde in

HStack{
VStack{
Text("Total du solde en cours").font(.system(size: 14)).multilineTextAlignment(.center)
Text("\(solde.total.wrappedValue)").padding(.top,5).font(.system(size: 12)).foregroundColor(.gray).multilineTextAlignment(.center)
}
Spacer()
VStack{
Text("Etat de la demande").font(.system(size: 14)).multilineTextAlignment(.center)
Text("\(solde.etat.wrappedValue)").padding(.top,5).font(.system(size: 12)).foregroundColor(.gray).multilineTextAlignment(.center)
}
Spacer()
VStack{
Text("Date d'émission").font(.system(size: 14)).multilineTextAlignment(.center)
Text("\(solde.date.wrappedValue)").padding(.top,5).font(.system(size: 12)).foregroundColor(.gray).multilineTextAlignment(.center)
}
Spacer()
Button {
selectedSoldeID = solde.id
selectedSoldeOwner = solde.proprietaire.wrappedValue
isDocumentPickerPresented.toggle()
} label: {
Text("Envoyer la facture").multilineTextAlignment(.center)
}.sheet(isPresented: $isDocumentPickerPresented) {
DocumentPickerView(selectedURL: $selectedURL,soldeDataId:$selectedSoldeID,soldeOwner:$selectedSoldeOwner)
}
}
}

Button {

} label: {
HStack{
Text("DEMANDER MON SOLDE").fontWeight(.semibold)
Image(systemName: "arrow.right")

}.foregroundColor(.white)
.frame(width: UIScreen.main.bounds.width - 32, height: 48)
}.background(Color(.systemBlue)).cornerRadius(10).padding(.top,24)


NavigationLink {
UserDashboard().navigationBarBackButtonHidden(true)
} label: {
HStack(spacing: 3){
Text("Retour à la page")
Text("Principale").fontWeight(.bold)
}.font(.system(size: 14))
}
}
}
}

private func formatDate(_ date: Date) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd/MM/yyyy"
return dateFormatter.string(from: date)
}

//Mettre à jour firestore et firebase avec la facture
func uploadInvoice(url:String,iddocument:String,filename:String){

}

struct DocumentPickerView: UIViewControllerRepresentable {
@Binding var selectedURL: URL?
@Binding var soldeDataId: String?
@Binding var soldeOwner: String?
@EnvironmentObject var soldeModel: SoldeModel

func makeUIViewController(context: Context) -> some UIViewController {
let controller = UIDocumentPickerViewController(forOpeningContentTypes: [.png,.pdf,.jpeg,], asCopy: true)
controller.delegate = context.coordinator
return controller
}

func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {

}

func makeCoordinator() -> Coordinator {
Coordinator(self)
}

class Coordinator: NSObject, UIDocumentPickerDelegate {
let parent: DocumentPickerView

init(_ parent: DocumentPickerView) {
self.parent = parent
}

private func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) async {
if let selectedURL = urls.first {
parent.selectedURL = selectedURL
if let soldeDataid = parent.soldeDataId{
let filename = selectedURL.lastPathComponent
let storageRef = Storage.storage().reference().child("invoices/\(parent.soldeOwner ?? "unknow")/\(parent.soldeDataId ?? "solde")/\(filename)")

storageRef.putFile(from: selectedURL, metadata: nil) { metadata, error in
if let error = error {
print("Erreur lors de la mise à jour du fichier Firebase Storage : \(error.localizedDescription)")
} else {
print("Fichier mis à jour avec succès dans Firebase Storage")
}
}
do {
try await parent.soldeModel.sendInvoiceFileName(filename: filename, idsoldedocuement: soldeDataid)
print("Nom du fichier envoyé à Firebase Firestore avec succès.")
} catch {
print("Erreur lors de l'envoi du nom du fichier à Firebase Firestore : \(error)")
}
}
}
}
}
}

struct UserSolde_Previews: PreviewProvider {
static var previews: some View {
UserSolde()
}
}


For people who ask me what is "solde" it's like an invoice for me. this is the code :

对于那些问我什么是“solde”的人来说,这就像是一张发票。这是代码:


//
// Solde.swift
// ML2V_IOS
//
// Created by Clément Enjolras on 05/09/2023.
//

import Foundation

struct Solde: Identifiable,Codable{
var id: String
var date: Date
var etat: String
var facture: String
var proprietaire: String
var total:Int
}


The error come from my code ? the simulator ? or this is a bug from iOS ? how can I fix this problem. I'm new into swift development if somebody can explain me I will be so thankful

错误来自我的代码?模拟器?或者这是iOS的一个bug?我该如何解决这个问题。如果有人能解释我,我会非常感激的


更多回答

Include the error message as text in your question

在问题中以文本形式包含错误消息

I just did it ! this is what you want ?

我刚刚做到了!这就是你想要的?

Do you have an idea about what I'm talking about ?

你知道我在说什么吗?

优秀答案推荐
更多回答

54 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com