Post

Replies

Boosts

Views

Activity

Guideline 5.2.3 - Legal - Intellectual Property - Audio/Video Downloading
Hello everyone, I developed an iOS mobile application that allows users to download videos from platforms other than YouTube. However, Apple rejected my app due to Guideline 5.2.3 - Legal - Intellectual Property - Audio/Video Downloading. Some apps also offer similar features. So, how were these apps published? If anyone has a similar experience or knowledge about this, could you please help? Thank you!
1
0
871
Oct ’24
[Core Data]: threw while encoding a value. with userInfo of (null)
I am getting the following error while saving data to CoreData. my model has the dictionary property. I created NSSecureCoding and NSSecureUnarchiveFromDataTransformer classes. please check if i can encode my model correctly. I couldn't understand what I am doing wrong ? The problem is not with Dictionary or Data properties. Why can't I save data to CoreData? I know little English. Thank you for your understanding. GitLab Project Link: It is a very simple one page project. I will be glad if you check it out. Core Data Test Project Console Output: 2021-08-21 23:58:18.490834+0300 CoreDataTest[35689:2901360] [error] error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x2827f0240> , <shared NSSecureUnarchiveFromData transformer> threw while encoding a value. with userInfo of (null) CoreData: error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x2827f0240> , <shared NSSecureUnarchiveFromData transformer> threw while encoding a value. with userInfo of (null) Failed to save selected category: A Core Data error occurred. Core Data Entity: My Custom Model: Notice my model has a Dictionary. var sections: [QuestionSections.RawValue : String] I am trying to save dictionary in CoreData. I thought the problem was in the dictionary but the problem is not in the dictionary. class QuestionContainer: NSObject, Codable { var questionCategories: [Question] init(questionCategories: [Question]) { self.questionCategories = questionCategories } } public class Question: NSObject, Codable { var title: String var id: String var questions: [QuestionList] init(title: String, id: String, questions: [QuestionList]) { self.title = title self.id = id self.questions = questions } } public class QuestionList: NSObject, Codable { init(id: String, question: String, isQuestionImage: Bool, isSectionImage: Bool, imageURL: String, imageData: Data? = nil, sections: [QuestionSections.RawValue : String], selected: String, correct: String) { self.id = id self.question = question self.isQuestionImage = isQuestionImage self.isSectionImage = isSectionImage self.imageURL = imageURL self.imageData = imageData self.sections = sections self.selected = selected self.correct = correct } var id: String var question: String var isQuestionImage, isSectionImage: Bool var imageURL: String var imageData: Data? var sections: [QuestionSections.RawValue : String] var selected: String var correct: String } enum QuestionSections: String, Codable { case A = "A" case B = "B" case C = "C" case D = "D" } NSSecure Unarchive From Data Transformer: @objc(QuestionsValueTransformer) class QuestionsValueTransformer: NSSecureUnarchiveFromDataTransformer { static let name = NSValueTransformerName(rawValue: String(describing: QuestionsValueTransformer.self)) override static var allowedTopLevelClasses: [AnyClass] { return [QuestionsNSSecureCoding.self] } public static func register() { let transformer = QuestionsValueTransformer() ValueTransformer.setValueTransformer(transformer, forName: name) } } CoreData Save Function: func saveSelectedQuestion(questionTitle: String, id: String, questions: [QuestionList]) { let questionsCD = QuestionCD(context: persistentContainer.viewContext) questionsCD.title = questionTitle questionsCD.id = id questionsCD.questions = questions do { try persistentContainer.viewContext.save() } catch { print("Failed to save selected category: \(error.localizedDescription)") } }
1
0
2.3k
Jul ’23
Are VIPER, RIBs, Redux and VIP applicable for SwiftUI?
Which design pattern should I choose for SwiftUI? SwiftUI introduced its own set of challenges in the system’s design, so the patterns we had for UIKit have to be re-designed from the ground up. The completely new design of the data flow in SwiftUI coupled with native support of view-state bindings shrank the required setup code to the degree that Presenter becomes a goofy entity doing nothing useful.
1
0
697
Nov ’21
Multiple NSEntityDescriptions claim the NSManagedObject subclass 'QuestionCD' so +entity is unable to disambiguate.
I am getting the following error while saving data to CoreData. I made this project completely simple for you to review my project. There is Local json in the project. You can download and test my project. Project GitLab Link: Core Data Test Project 2021-08-20 23:15:33.153215+0300 CoreDataTest[29156:2365912] [error] warning: Multiple NSEntityDescriptions claim the NSManagedObject subclass 'QuestionCD' so +entity is unable to disambiguate. CoreData: warning: Multiple NSEntityDescriptions claim the NSManagedObject subclass 'QuestionCD' so +entity is unable to disambiguate. 2021-08-20 23:15:33.153422+0300 CoreDataTest[29156:2365912] [error] warning:   'QuestionCD' (0x282ef02c0) from NSManagedObjectModel (0x283ad45f0) claims 'QuestionCD'. ....... Failed to save selected category: A Core Data error occurred. Source Editor Functionality Is Limited Error (What is this ? / Why ?): Core Data Entities: Core Data Save Function: func saveSelectedQuestion(questionTitle: String, id: String, questions: [QuestionList]) { let questionsCD = QuestionCD(context: persistentContainer.viewContext) questionsCD.title = questionTitle questionsCD.id = id questionsCD.questions = questions do { try persistentContainer.viewContext.save() } catch { print("Failed to save selected category: \(error.localizedDescription)") } } Model: class QuestionContainer: NSObject, Codable { var questionCategories: [Question] init(questionCategories: [Question]) { self.questionCategories = questionCategories } } class Question: NSObject, Codable { var title: String var id: String var questions: [QuestionList] init(title: String, id: String, questions: [QuestionList]) { self.title = title self.id = id self.questions = questions } } public class QuestionList: NSObject, Codable { init(id: String, question: String, isQuestionImage: Bool, isSectionImage: Bool, imageURL: String, imageData: Data? = nil, sections: Sections, selected: String, correct: String) { self.id = id self.question = question self.isQuestionImage = isQuestionImage self.isSectionImage = isSectionImage self.imageURL = imageURL self.imageData = imageData self.sections = sections self.selected = selected self.correct = correct } var id: String var question: String var isQuestionImage, isSectionImage: Bool var imageURL: String var imageData: Data? var sections: Sections var selected: String var correct: String } public class Sections: NSObject, Codable { init(a: String, b: String, c: String, d: String) { self.a = a self.b = b self.c = c self.d = d } var a, b, c, d: String private enum CodingKeys: String, CodingKey { case a = "A" case b = "B" case c = "C" case d = "D" } } Page Where I Save Data: I am saving data from this page. struct QuestionCategoryCellView: View { @ObservedObject var questionCategoryCellViewModel = QuestionCategoryCellViewModel() var questionTitle: String var questionID: String @Binding var questions: [QuestionList] var body: some View { Button(action: { print("title: \(questionTitle)") if questionCategoryCellViewModel.searchCategoryInCoreData(id: questionID) { print("already saved") } else { questionCategoryCellViewModel.saveSelectedQuestionsToCoreData(questionTitle: questionTitle, id: questionID, questions: questions) } }) { Text(questionTitle) } } }
0
0
2.1k
Aug ’21
SwiftUI Generic Binding Array
https://developer.apple.com/forums/thread/652064 how can I solve my problem like here or in a different way. When I make the Binding variable generic, I want to access the image property in the Array.  I am trying to make it a Generi Array. I will take two different models in it and I want to reach the image property in the model. How can I do that ? I use two different models in different page transitions. How can I make the array holding the model generic? Model 1: struct TrafficSignContainer: Codable, Hashable {     var trafficQuestions: [TrafficSign]? } enum TrafficSignSectionType: String, Codable, Hashable {     case A = "A"     case B = "B" } struct TrafficSign: Codable, Hashable {     var id: Int?     var image: String?     var sections: [TrafficSignSectionType.RawValue : String]?     var correct: String? } Model 2: struct PoliceSignContainer: Codable, Hashable {     var policeQuestions: [PoliceSign]? } enum PoliceSignSectionType: String, Codable, Hashable {     case A = "A"     case B = "B"     case C = "C" } struct PoliceSign: Codable, Hashable {     var id: Int?     var image: String?     var sections: [PoliceSignSectionType.RawValue : String]?     var correct: String? } View: struct QuestionCardViewd: View {     @EnvironmentObject var signQuestionProvider: SignQuestionProvider     @EnvironmentObject var optionConfigure: OptionConfigure     @Binding var questions: [T]     var body: some View {         VStack {             HStack {                 Text("\(optionConfigure.step + 1) /")                     .bold()                 Text("\(optionConfigure.questionCount)")             }             .padding(5)            .background(Color(UIColor.secondarySystemBackground))             .cornerRadius(10)             .offset(y: -25)             ZStack {                 ForEach((questions.indices).reversed(), id: \.self) { index -> AnyView in                     let relativeIndex = index - optionConfigure.step                     switch relativeIndex {                     case 0...2:                         return AnyView(                             ImageCard(image: .constant("\(questions[index].image ?? "p1")")) **//-> here **                                 .offset(y: CGFloat(relativeIndex * -35))                                 .opacity(2.5 - Double(relativeIndex))                                 .scaleEffect(1 - CGFloat(relativeIndex) * 0.1)                         )                     default:                         return AnyView(EmptyView())                     }                 }             }             .animation(.spring())             OptionView()         }         .onDisappear {             optionConfigure.step = 0             optionConfigure.selected = ""         }     } }
1
0
1.5k
Aug ’21
show wrong answer in multiple selection in SwiftUI
When a wrong option is selected, I want to show the wrong option in red and then the correct option in green automatically. But I couldn't do the algorithm for it. How can I do that ? I prepared a sample project about the structure I use. I couldn't show the correct option and the wrong option at the same time when only the wrong option was selected. Model struct QuestionContainer: Codable, Hashable { var questions: [Question]? } struct Section: Codable, Hashable { var a, b, c, d: String private enum CodingKeys: String, CodingKey { case a = "A" case b = "B" case c = "C" case d = "D" } } struct Question: Codable, Hashable { var number: Int? var question: String? var sections: Section? var price: Int? var correct: String? } QuestionView struct QuestionView: View { @ObservedObject var questionViewModel: QuestionViewModel var body: some View { VStack { Text(questionViewModel.question.questions?[0].question ?? "empty") SectionView(sectionViewModel: SectionViewModel(section: questionViewModel.question.questions?[0].sections?.a ?? "empty", correct: questionViewModel.question.questions?[0].correct ?? "empty")) SectionView(sectionViewModel: SectionViewModel(section: questionViewModel.question.questions?[0].sections?.b ?? "empty", correct: questionViewModel.question.questions?[0].correct ?? "empty")) SectionView(sectionViewModel: SectionViewModel(section: questionViewModel.question.questions?[0].sections?.c ?? "empty", correct: questionViewModel.question.questions?[0].correct ?? "empty")) SectionView(sectionViewModel: SectionViewModel(section: questionViewModel.question.questions?[0].sections?.d ?? "empty", correct: questionViewModel.question.questions?[0].correct ?? "empty")) } } } QuestionViewModel class QuestionViewModel: ObservableObject { @Published var question: QuestionContainer = QuestionContainer() init() { getQuestions() } func getQuestions() { question = QuestionContainer(questions: [Question(number: 1, question: "What is the chemical formula for water ?", sections: Section(a: "CO2", b: "H2O", c: "C2H6O", d: "H2N"), price: 5, correct: "H2O")]) } } SectionView struct SectionView: View { @ObservedObject var sectionViewModel: SectionViewModel @State var color: UIColor = .gray var body: some View { Button(action: { sectionViewModel.selected = sectionViewModel.section color = sectionViewModel.prepareResultColor() print("correct: \(sectionViewModel.correct)") print("selected: \(sectionViewModel.selected)") }) { ZStack { RoundedRectangle(cornerRadius: 20) .stroke(Color(color), lineWidth: 2) .frame(width: 340, height: 50) HStack { Text(sectionViewModel.section) .foregroundColor(Color(UIColor.gray)) .bold() Spacer() ZStack { Circle() .foregroundColor(Color(UIColor.orange)) Circle() .stroke(Color(UIColor.orange).opacity(0.4), lineWidth: 2) Image(systemName: "checkmark") .resizable() .frame(width: 12, height: 12) .font(.system(size: 15, weight: .bold, design: .rounded)) .foregroundColor(.white) } .frame(width: 20, height: 20) } .padding(.horizontal) .padding(.vertical, 12) .frame(width: 340) } } } } SectionViewModel class SectionViewModel: ObservableObject { @Published var section: String = "" @Published var correct: String = "" @Published var selected: String = "" init(section: String, correct: String) { self.section = section self.correct = correct } func prepareResultColor() -> UIColor { if correct == selected && selected != "" { return .green } else if correct != selected && selected != "" { return .red } else { return .gray } } }
0
0
502
Jun ’21
I can only see one sale in the Sales and Trends category.
While the app was pre-ordered, there was a sale in Canada and I can see it in the Sales and Trends category. (June 13) However, yesterday there was a sale in Turkey, but I can't see it in the Sales and Trends category. Does it take long for Apple to update this list? There was a sale from Turkey yesterday, but I can't see it. Why is that ? And I can't select yesterday's date. There was a sale from Turkey yesterday. I can't see this.
0
0
631
Jun ’21
MultipeerConnectivity data Convert to Dictionary
I have a variable in Dictionary type. How can I change the data on the Section Function to Dictionary? Stringdata in the Section function shows the same value in both variables? I have to separate these values. How can I do that ? ViewModel @Published var dictionaryValues:[String: String] = ["word":"","answer":""] Random Word Session Func func randomWordSession() {         guard let word = dictionaryValues["word"]?.data(using: .utf8) else { return }         guard let pears = session?.connectedPeers else { return }         do {             try session?.send(word, toPeers: pears, with: .reliable)         } catch {             print(error.localizedDescription)         }     } Answer Session func answerSession() {         guard let answer = dictionaryValues["answer"]?.data(using: .utf8) else { return }         guard let peers = session?.connectedPeers else { return }         do {             try session?.send(answer, toPeers: peers, with: .reliable)         } catch {             print(error.localizedDescription)         }     } Session Func func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID) {         if let stringData = String(data: data, encoding: .utf8) {             DispatchQueue.main.async {                 self.dictionaryValues["word"] = stringData                 self.dictionaryValues["answer"] = stringData             }         }     }
3
0
1.1k
Apr ’21
SwiftUI MultipeerConnectivity receiving two different data from a single device
Project Github link - https://github.com/ufukkosker/SwiftUIMultipeerConnectivity You can download and test my project. There is a video link in the github project about the use of the project. After initially establishing a connection between both devices, I successfully show the same word on both devices. After choosing, the variables der, die, das are replaced by the word. I know the problem but I don't know how to fix it. This is what I want to do. Showing the same word on both devices after the devices are paired. Checking the answers after the selection has been made on both devices. A small quiz contest. I want to compare the answer from both devices. I don't know how to do this. for example; Suppose the answer "das" is correct for the first word. The user will mark "das" on the first device, and the user will mark "der" on the second device. the first device will get +1 points, the second device will not get any points. Here is the problem: I apply two different send operations to a single data. Problem is here I am sending the same data to two different variables. How can I get two different data?  func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID) {         if let stringData = String(data: data, encoding: .utf8) {             DispatchQueue.main.async {                 self.randomWord = stringData                 self.selectedArtikel = stringData             }         }     } GameViewModel import MultipeerConnectivity class GameViewModel: NSObject, ObservableObject {          @Published var words: [Word] = []     @Published var randomWord: String = ""     @Published var selectedArtikel = ""     private var connectFourServiceType = "artikel"     private var peerID: MCPeerID?     private var session: MCSession?     private var nearByServiceAdvertiser: MCNearbyServiceAdvertiser?          override init() {         super.init()         peerID = MCPeerID(displayName: UIDevice.current.name)         session = MCSession(peer: peerID ?? MCPeerID(displayName: UIDevice.current.name), securityIdentity: nil, encryptionPreference: .required)         self.getWords()         self.getRandomWord()         session?.delegate = self     }          func advertise() {         guard let peerID = peerID else { return }         nearByServiceAdvertiser = MCNearbyServiceAdvertiser(peer: peerID, discoveryInfo: nil, serviceType: connectFourServiceType)         nearByServiceAdvertiser?.delegate = self         nearByServiceAdvertiser?.startAdvertisingPeer()     }          func invite() {         guard let session = session else { return }         let browser = MCBrowserViewController(serviceType: connectFourServiceType, session: session)         browser.delegate = self         UIApplication.shared.windows.first?.rootViewController?.present(browser, animated: true)     }          func randomWordSession() {         guard let word = randomWord.data(using: .utf8) else { return }         guard let pears = session?.connectedPeers else { return }         do {             try session?.send(word, toPeers: pears, with: .reliable)         } catch {             print(error.localizedDescription)         }     }          func selectedSendSession() {         guard let data = selectedArtikel.data(using: .utf8) else { return }         guard let peers = session?.connectedPeers else { return }         do {             try session?.send(data, toPeers: peers, with: .reliable)         } catch {             print(error.localizedDescription)         }     }          func getRandomWord() {         DispatchQueue.main.async {             let randomNumber = Int.random(in: 0..self.words.count)             self.randomWord = self.words[randomNumber].word         }     }          func getWords() {         if let url = Bundle.main.url(forResource: "derdiedas", withExtension: "json") {             do {                 let data = try Data(contentsOf: url)                 let decoder = JSONDecoder()                 let word = try decoder.decode(WordContainer.self, from: data)                 self.words = word.words             } catch {                 print("error:\(error)")             }         }     } } extension GameViewModel: MCSessionDelegate {     func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState) {         switch state {         case .notConnected:             print("\(peerID) state: not connected")                      case .connecting:             print("\(peerID) state: connecting")                                   case .connected:             print("\(peerID) state: connected")                                   @unknown default:             print("\(peerID) state: unknown")         }     }          func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID) {         if let stringData = String(data: data, encoding: .utf8) {             DispatchQueue.main.async {                 self.randomWord = stringData                 self.selectedArtikel = stringData             }         }     }          func session(_ session: MCSession, didReceive stream: InputStream, withName streamName: String, fromPeer peerID: MCPeerID) {              }          func session(_ session: MCSession, didStartReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, with progress: Progress) {              }          func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, at localURL: URL?, withError error: Error?) {     } } extension GameViewModel: MCNearbyServiceAdvertiserDelegate {     func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didReceiveInvitationFromPeer peerID: MCPeerID, withContext context: Data?, invitationHandler: @escaping (Bool, MCSession?) - Void) {         invitationHandler(true, session)     } } extension GameViewModel: MCBrowserViewControllerDelegate {     func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) {         browserViewController.dismiss(animated: true)     }          func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController) {         browserViewController.dismiss(animated: true)     } }
0
0
887
Apr ’21