Post

Replies

Boosts

Views

Activity

Siri Shortcuts timing out on device but run fine on the simulator
I'm working on an App that takes a photo and adds a filter to it through the shortcuts app. Works fine in the simulator, but when I run on my iPad and iPhone I receive this message: I attempted to change the size of the image to see if that would speed things up, but I'm left with the same results. My intents handler: import Foundation import Intents import SwiftUI class DrawingIntentHandler: NSObject, GenerateDrawingIntentHandling{     func handle(intent: GenerateDrawingIntent, completion: @escaping (GenerateDrawingIntentResponse) -> Void) {         let response = GenerateDrawingIntentResponse(code: .success, userActivity: nil)         guard let param = intent.images else {return}         guard let filename = param.fileURL else { return }                  guard let fileimage = UIImage(contentsOfFile: filename.path) else { return }              guard let cartoon = Cartoonify(image: fileimage).result else {return}         guard let pngData = cartoon.pngData() else { return  }         response.drawing = INFile(data: pngData, filename: param.filename, typeIdentifier: "public.png")         completion(response)     }     func confirm(intent: GenerateDrawingIntent, completion: @escaping (GenerateDrawingIntentResponse) -> Void) {         completion(GenerateDrawingIntentResponse(code: .ready, userActivity: nil))     }      }
0
0
894
Jun ’21
Can Execution Time Allowance catch EXC_BAD_ACCESS
So I have an App that has a UITest trying to break it by rapidly pressing the same button over and over again (it's a known issue in our app that we're trying to fix). Of course this crash leads to a Thread 1: EXC_BAD_ACCESS (code=2, address=0x7b0400013af0) and stalls the rest of our UI tests. I was wondering if I could use Execution Time Allowance to have testing continue after the EXC_BAD_ACCESS. I was under the impression from the #WWDC2020 video that it could. Also does this feature only work with Test Plans? (here is the WWDC2020 video I watched about time allowance - https://developer.apple.com/videos/play/wwdc2020/10221/) Also here is my test: func testKeyboardDelete() { executionTimeAllowance = 30 let app = XCUIApplication() let notes = app.buttons["notesIcon"] notes.waitForExistence(timeout: 1) notes.tap() app.buttons["New Note"].tap() let typeNoteHereTextView = app.textViews.containing(.staticText, identifier:"Type note here...").element typeNoteHereTextView.waitForExistence(timeout: 1) typeNoteHereTextView.tap() let staticText = app/*@START_MENU_TOKEN@*/.staticTexts["⌫"]/*[[".keys[\"Delete\"].staticTexts[\"⌫\"]",".staticTexts[\"⌫\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/ for i in 0..100{ print(i) staticText.tap() } }
0
0
644
Mar ’21
SwiftUI Preview will not render for WatchOS with `HumanReadableNSError: The run destination iPhone 12 Pro Max is not valid for Running the scheme 'WatchOCalculator'. IDEFoundationErrorDomain (1):`
Issue My SwiftUI Views will not render with the error HumanReadableNSError: The run destination iPhone 12 Pro Max is not valid for Running the scheme 'WatchOCalculator'. IDEFoundationErrorDomain (1): What I did to attempt to fix it I created a whole new SwiftUI file with a new view and preview I get an error from the Preview saying consecutive statements on a line must be separated by ';' CompileDylibError: Failed to build Extentions.swift Compiling failed: consecutive statements on a line must be separated by ';' /Users/ian/Documents/github/OCalculator/Shared/Extentions.swift:28:4: error: consecutive statements on a line must be separated by ';'                 }#sourceLocation()                  ^                  ; ================================== All of my code compiles and my extensions file at line 28 looks like this: extension String{ func matchesForRegexInText(regex: String!) -> [String] { do { let regex = try NSRegularExpression(pattern: regex, options: []) let nsString = self as NSString let results = regex.matches(in: self, options: [], range: NSMakeRange(0, nsString.length)) return results.map { nsString.substring(with: $0.range)} } catch let error as NSError { print("invalid regex: \(error.localizedDescription)") return [] }} } (The above code is from this Stack Overflow question - https://stackoverflow.com/questions/33693021/finding-text-between-parentheses-in-swift I just modified it to be a string extension.) Has anyone else experienced this trying to make a Multiplatform app? The SwiftUI previews seem to stop working pretty quickly into development.
2
0
1.7k
Feb ’21