Learn Courses My Dashboard

App works on my device, but not at Apple

I sent my app for review to Apple. They rejected it because it wouldn’t load. Just showed a black screen. It works fine on my iPhone, iPad, and the simulator.

Any idea what could cause this?

I was thinking that there might be something wrong with the archive I sent them, but if that’s the case, I have no idea how to fix it.

What does your app do? It could be many things, the backend not loading, an issue with the archive (just make a new archive with a new build number) etc.

You could maybe try pushing the build to TestFlight and then have someone else (who’s never downloaded the app on their device) download it from TestFlight and see if the same thing happens.

1 Like

Thanks for responding.

I couldn’t get it on TestFlight for the same reason that it failed at Apple – black screen on startup.

I’m assuming that it’s an issue with the archive. I upped the build number, plugged in my iPhone, selected it as the target, and created a new archive. (Last time, I used “Generic IOS Device” as the target)… I then sent the new archive to the App Store.

I have a copy of the archive on my desktop, but I don’t see how to use it to test the app. Any help there?

You should be using generic iOS device when making the archive.

What’s the app do? Is it trying to contact a server that’s not responding?

The instructions I read said to use generic or, if available, a real device.

The app doesn’t contact a server. When it’s newly installed, it just displays a screen with a sentence saying how to add an item.

That’s odd… try deleting the derives data folder and cleaning the project.

And does anything change? When you try a fresh install on a device (like delete the old build on the device and reinstall)

Also try contacting Apple and find out what device they’re using? Maybe and show them what you expect to happen (see on the screen) and ask if they have any ideas

That’s odd if you’re not contacting any server at all and it’s showing a black screen

You’re getting past my knowledge level. What is the derives data folder and how do I clean the project?

I already sent them a screenshot of what I expect and asked them. They had no comment about that.

One thought I had: I have code for a view that I don’t use (only for testing) so I commented out the code that invokes it. Therefore, I have two files that are not referenced anywhere in the code. Could that be a problem?

I’m going to try deleting those files and rebuilding, but the only way I can test it is to send it to Apple.

Derived Data is a folder that holds Xcode build files, to help Xcode build faster each time you run, rather than always having to build from scratch

Cleaning your project is the same thing (but they delete separate things) (all different files Xcode uses to build the project)

No, i highly doubt it. Commented out code is just that. It’s commented out and does nothing

Go to Xcode preferences > Locations

Under a drop down that says derived data there’s a file path and then an arrow. Click on that arrow and it brings up finder. Delete the derived data folder

To clean the project click Cmd + Shift + K

Quit Xcode and open it again and try to run your project and see if what Apple is experiencing is what you get, or if your app works, create a new archive and send to Apple

This is a long shot but I’m curious to know if there was a file that you added to your project from an external source that is a reference only rather than a copy? The reason I ask is that you say the program works fine when you run it on a simulator but Apple are saying that when they build and run it they get a blank screen.

What I mean by a reference is that it IS possible to add a file to a project that contains some code or data that you want to make use of and if you don’t check the “Copy” option when you drag the file into the project, it looks like the file is in the project but it is a reference rather than a copy.

If any file is a reference only then when someone else runs the program it wont be able to find that file since the reference is to a location on your Mac.

Like I said, this is a long shot but nevertheless I thought it worth asking the question.

Thanks for responding. This is really frustrating. It’s my first app and I spent six months getting it just right. The last thing I expected from Apple was a report of a blank screen.

I understand that the commented code won’t have an effect. I was concerned about the two files that are there that don’t get referenced because the code that references them is commented out. Just to be sure, I’m going to remove those files.

  • deleted Derived Data folder (moved to trash)
  • cleaned build folder (so quick I thought it didn’t work)
  • closed Xcode
  • opened Xcode & double-clicked on my project – nothing happens (this happens periodically. I have to open another project, then use File->Recent Projects to open this one.)
  • Ran project using iPhone 12 simulator. Works just fine.

This could be a problem:
Ran project again using ‘Build for running’ on iPhone 12 simulator. Nothing happened. No simulator showed up. The box at the top says “Running Bills & Periodicals on iPhone 12”.

I’m not going further until I hear from you guys. Is this an indication of my problem?

Oh Chris, thanks for the suggestion, but I didn’t add any external files to the project.

Just an update. I tried ‘Build for Running’ on another project (from Hacking with Swift) with the same result. Same thing happened when I tried to build to my iPad 10s.

What do you mean by nothing happens?
If you deleted the Build Folder (having removed the DerivedData folder) then Xcode will need to create a new DerivedData folder and then creates a build for your project in the DerivedData folder. It’s possible that this could take a little while depending on the project size and depending on if you have external frameworks installed as would be the case if you have Pods installed. There are a bunch of “IF’s” that might affect that time.

I waited several minutes and the project did not appear. When I opened a different project, then opened my project with ‘Recent Projects’, it opened right away. This has happened before with both the current and beta version of Xcode.

What I’m really concerned about is that, when I ‘build for running’, the app does not start either in the simulator or my iPhone 10s. This is the case for other projects as well.

What I’m asking is, could this be an indication of the problem I’m having at the App Store? If so, then maybe there’s something wrong with my Xcode installation. At least, if it’s the same problem, I’ll be able to test without having to send an archive to Apple.

I don’t have any of those external files you mentioned. It’s really a simple app. List of items, add or edit items, send notifications and update icon badge. Nothing fancy.

We can’t really tell if that’s the root cause of the issue but it’s a possibility.

I would suggest completely deleting Xcode from your machine and then re-installing it

It happens with both the current version and the beta version, so I’m not getting my hopes up for that solution.

Please confirm one thing for me. When I build for running with a simulator as the target, I should get the simulator to show up, just as it does when I build for testing.

If that’s the case, then at least I’ll know when I’ve fixed the problem.

Thanks for sticking with me.

What do you mean??? Just running the project the simulator should come up and begin running your app

It does when I just click the build button (:arrow_forward:), but when I select ‘Build for Running’, it does not. I don’t know what the difference is. I just want to confirm that’Build for Running’ isn’t just supposed to create some files.

Sorry if this is a dumb question. I’m still new to this platform.

I was beginning to wonder if I had missed something but now I understand what you are referring to. In all the years that I have been using Xcode I have never used the Xcode menu to run a project. ie Product > Build For > Running. I have always used Command + R or tapped on the Play button.

I have no clue what those options do.

Thanks. I just found that by accident and thought maybe that was a way to test for this problem.

So I have an archive on my desktop. The same archive that I sent to Apple. How can I use this archive to test the app the same way that Apple tests it? When I test it with the build button, it works fine.

go to Product → Scheme → Edit Scheme … on Run go to the Info tab and change the “debug” into “release”… this would make your app build in “release” mode

test your app and see it if works using this mode