Post

Replies

Boosts

Views

Activity

UI Test specific view controllers outside the app
Hi,I have a couple of very complicated view controllers that I want to be able to test thoroughly and ideally I would start the specific view controller and give it some initial conditions, interact with the UI, and then check the results.I can't really do this sort of testing in the main app as that gets all of its data from a server and I don't want to involve the server for these tests. I just want to make sure the UI is modifying the data properly. These particular View Controllers have had the most bug regressions and so I wanted to test every aspect of them with a heap of UI tests.Even if I were to run this as UI test, it's still not enough. I want to make sure the view controller is modifying the data correctly so I need access to the underlying model data which you can't access in a UI Test. I want to click around in the UI, and then check that data looks right.If it was a standard non-UI test then it could have access to the data model which would be great.Is there a way to have a hybrid testing solution where I run these as standard non UI tests but have access to all the XCUIApplication goodness? I have tried but if you call XCUIApplication inside a normal test it crashes saying that there is not target application. If you try to initialise it with a bundleID, it takes a very long time (several minutes) and ends up failing anyway.Is this just not possible?I have a ugly solution that I'm working through at the moment where I modify my AppDelegate to load up a completely different testing UI if launched from a UI Test. The UI is a basic UITableViewController with all of my tests listed, and I go through them one at a time. This is very ugly and it pains me to modify my normal code to handle UI Testing but I can't see an alternative. It also means that I now have to have my testing code in multiple places - one is the new table view controller that initialises the UI with specific data, and the UI Test itself.Am I missing something?Mof.
0
1
1.4k
Mar ’20
UIImagePicker returns without an image
Currently I'm using UIImagePickerController to allow our users to take photos within the app like so: UIImagePickerController *picker = [UIImagePickerController new]; picker.sourceType = UIImagePickerControllerSourceTypeCamera; picker.mediaTypes = @[(NSString *)kUTTypeImage]; picker.delegate = self; [self presentViewController:picker animated:YES completion:nil]; And I use the delegate method to get the image out and do what is needed: -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info { // Do stuff. } This seems to work fine for 99.9% of our users but for some reason we occasionally have an odd info dictionary with no image in it. When I print the info dictionary, it looks like this every time: {    UIImagePickerControllerMediaMetadata =     {        "{MakerApple}" =         {            25 = 0;        };    };    UIImagePickerControllerMediaType = "public.image"; } As you can see there is no UIImagePickerControllerEditedImage or UIImagePickerControllerOriginalImage in that dictionary. Anyone have any ideas on what this is, and what I might be able to do to 'fix it' ?
0
0
469
Jun ’22
Our app can consistently kill springboard
In our app we have a form builder and something that has been working fine for years now crashes springboard every time without fail. The whole screen goes black with a grey spinner in the middle, and then after a little period I get put back on the home screen. In the Xcode Simulator, it doesn't crash springboard but instead the Simulator process and its child 'backboardd' end up using up all the memory in my machine until either it grinds my machine to the point its barely usable or I manually force kill the backboardd process. I really dont understand how my sandboxed app is killing springboard. I've gone through my code and commented out bits until it stopped crashing springboard, and its something to do with calling invalidateIntrinsicContentSize of a UIView. I suspect this is not the issue and may just be some weird side affect of the real problem. I need to have that code in there, so I really can't ship a version without it easily. I really dont want to rewrite alot of my layout code here. Because my app is not 'crashing', I'm not getting any crash logs so I really can't tell how many of my users are being affected by this. Has anyone had an experience with anything like this? Any suggestions? I have filed a Feedback (FB11751672), and I am hopeful that it has enough information.
2
0
712
Nov ’22
Swift Charts use custom font for legend
We have a custom font we use through-out our app we've recently starting playing with Swift Charts but can't work out how to use our font in the chart legend easily. Currently we have a simple chart using the default .chartLegend(...). I've managed to use our font in the X-axis and Y-axis by creating our own labels using AxisValueLabel() {} However without making our own completely custom legend, is there a way to specify the font to use in the legend?
0
0
1k
Jan ’23
XCUIElement with zero frame but showing.
I have a bug I am writing a UI Test for and I am struggling to find a way to test the fixed UI vs the buggy UI. In the buggy version, the UI element is visible on the screen but has a 0,0 width and height. It's visible because it's not set to 'clip to bounds', so it's overlaying the rest of my UI. The app sets the element to be hidden in certain situations and I wanted to make sure in my test, that it's not on the screen in that situation. The problem is that .exists returns true in both situations (.hidden == true, .hidden == false), and .isHittable always returns false because its either no on the screen at all or has a 0,0 width, height. So I can't use .exists; I can't use .isHittable; and I can't use the .frame either. Is there simply a way to check if it's actually visible?
1
0
423
Jun ’24