Blank xcode app generating unexpected errors - ios

What I did was:
create new project via master detail template
select 'use core data'
build -> run using ios sim
I got the following error code:
the model used to open the store is incompatible with the one used to create the store
I googled around and read a lot about data migration and what not. I even following the directions and tried to migrate.
The model used to open the store is incompatible with the one used to create the store, apple store release version
But then it gave me another error message:
can't find model for source code
But since the app is not edited whatsoever, and there is only one version, why is there an issue with data migrating anyways? Shouldn't it just run with no error and just do nothing meaningful?

After the error is thrown, push the stop button on Xcode.
Then, go to the simulator (it should now be on the home screen) and delete the app.
You delete apps from the simulator the same way you do on an actual iPhone (hold down on the icon until it shakes and the 'x' appears in the corner).
Then, run the app again.
You probably, at some point, made another project with the same bundle-id. That project probably had a data-model which is different than the blank (or whatever the default data model is) in the template app, which causes your app to crash somewhere in your AppDelegate.m when it tries to load up the store.

Related

The file for the document x has been modified by another application. There are also unsaved changes in Xcode

Starting with Xcode 13.1 I am getting quitte often an alert "The file for the document x has been modified by another application. There are also unsaved changes in Xcode". Quite often I am using Atom editor and Tower Git simultaneously with Xcode, so in the first place I thought that the incorrect update of one of the above was due to. My solution was to close those apps but still occasionally, the alert still pops up. Now I think the problem is Xcode 13.1, are there other people experiencing this behavior?

iOS Project Copy Crashes during FirebaseAuth

So I'm working on a project using flutter in iOS, and I seem to have run into a brick wall.
First, I need to you know I DO have a 100% working copy of the project. No problems, No bugs, etc.
What I'm trying to do is create a second copy of the project with a few minor changes, and get that to work too. (Changes like text colour, and name of the app).
I'm using flutter to program this, running FirebaseAuth to authorize the end-user, and google-maps in the project afterwards.
Now after I made those minor changes, I can't seem to get the second project functional at all. (I've had it functional previously, but that build is lost. I should have used better source control).
Now I know I had to change the bundle identifier in XCode, which I've done both in the info.plist, and the General Tab of the xcode project. (Done opening up the workspace, not the project). Replaced the GoogleServices-Info.plist and added to the project through XCode. I've also replaced the value for the url scheme in the info.plist with the new value from the GoogleServices-Info.plist.
Also changed the API keys with the new ones I'm supposed to have for the new project. And made sure all the normal things like ensuring that Push Notifications are active on the project, etc.
So as far as I can remember, I've done everything that I should to get the project to function... But instead of stalling or giving me errors, it just crashes.
Running through Terminal using the command:
NO_PROXY=localhost,127.0.0.1; flutter run --verbose
I get the following error.
Error connecting to the service protocol: failed to connect to http://127.0.0.1:1033/
If I run it in Xcode I get the following error:
flutter: Phone Auth Verification Failed: Invalid token.
and if I run it in VSCode I don't even get that far.
Error connecting to the service protocol: failed to connect to http://127.0.0.1:1025/
I checked on their individual git's and issues boards, but I couldn't find anything in flutter or firebase that leads me to any idea as to what is even going on.
Does anyone have something like a checklist of places I could look for possible errors? (I'm pretty sure it's likely just a setting in XCode I forgot to change, or something like that). Much appreciated.
Open the Project in Xcode then,
Window > Devices & Simulators
Select the device and
Uncheck Connect Via network.

Switching Firebases in a Swift project

I accidentally added the wrong Firebase (let's call it OLD) to my Swift project, so today I went through the process of adding the correct one (NEW) instead. I deleted the old plist config file and added the new one, but when I run the app, I get an error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Provided bucket: OLD.appspot.com does not match bucket specified in FIRApp configuration: NEW.appspot.com'
In the GoogleService-Info.plist file, the STORAGE_BUCKET field correctly is NEW.appspot.com, and OLD.appspot.com doesn't show up anywhere. So how can I resolve this?
I have had this problem while dealing with two iOS accounts so I would expect the answer to be similar.
The primary reason is that the old user has been cached to your device. This means that each time you login with the newer one is errors due to expecting the old user which is set up on the previous url. Frustratingly deleting the app, cleaning the app, calling pod update, logging in on the new version and calling logout etc don't seem to have any affect on the problem.
This seems to occur when the user has logged and then a new version with a different url is loaded over the top.
The only way I managed to fix this was to reset the app to its previous settings (put back the OLD firebase url and also the OLD.plist google services file). Load up the app and then logout of the app, this should remove the cached user settings. Now when you load up with the new settings it should not log into the previous user (depending on your auto login app settings) and should allow you to successfully log into the new account.
While doing this remember to download the new .plist file and also make sure the correct bundleID and firebase url are entered.
NOTE: If you are experiencing this problem on the simulator I think you can reset the content and settings. This is found in
Simulator -> Reset Contents and Settings...
Hopefully this helps
I was able to fix this via checking my GoogleService-Info.plist.
If you've used the .plist file multiple times, make sure you've added the right one to your project.
You can always go back to your Firebase console.
Click on the settings icon next to Overview.
Click on Project Settings, choose the app you'd like to download the .plist file for.
Doing this will solve any issue...

How to restore my project wisely

So, it started as a simple test, where I had to delete my app from my iPhone (iOS4.3) just to check how the app behaves on a first run. (I am developing to support down to iOS4.3).
After the deletion, I wasn't able to run the app on my iPhone for some reason. The "Active Scheme" would show iOS Device, although I could manually select my own device from the list, the project wouldn't set my device by default. XCode would drop a message from the top saying:
Could not launch “project1” No such file or directory
(/Users/portal/Library/Developer/Xcode/DerivedData/project1-
cfjhjgezzcapwoadaivpptyywptu/Build/Products/Debug-iphoneos/project1.app/project
I went through this SO post (EDIT: Therefore, restarting XCode, iPhone doing clean project, hard resetting my iPhone) but this didn't change anything, except I can now delete the Derived data in Organizer.
I have a working backup at hand though. Thing is it is a bit outdated as I made many changes to the project. I can run the backed up project, and it seems sane as good.
Now my question is how can I merge the files back into the sane project? The XCode project itself has changed a bit, frameworks were put in as well as some settings.
I tried to simply copy the changed files into the old project, but all I get is a SIGABRT upon the first run. I did a FileMerge look, and saw that for some reason my projectAppDelegate.m is non existant in the PBXBuild section of the .xcodeproj file. which I didn't touch. seems like a mess here.
How can I merge the new project to the old one correctly?

Launch/Spash image does not change with Upgrade

In the next version of my iOS application, I modified the Default.png image. The new image (now localized) is featured prominently throughout the application.
To test the upgrade process on my device, initiate the installation from Xcode on a device that has previous version of the application. My problem is that during this mock upgrade, the splash image appears as the old Default.png. Additionally, when displaying Default.png elsewhere in the application, it also continues to be the old one.
However, if I first remove the application from the device, and afterwards install (rather than upgrade), the new splash image does appear properly.
How do I fix this, or is this to be expected when mock upgrading via Xcode? Can/Should I rely on the upgrade process executing properly when it happens through the app store?
The closest question seems to be this:
Updated splash / launch not working
The answer, though sounding great, seems speculative.
Thanks in advance.
I contacted Apple and they sent me the following:
https://developer.apple.com/library/ios/#technotes/tn2285/_index.html
It explains:
How to properly test for updates
That during an 'Xcode update' not all assets get refreshed
When properly testing the upgrade, assets do get replaced as they should
Long story short, test upgrades properly and things will appear as they should.
Here are a few things to try (not guarantees but worth a shot):
Delete the Derived Data for your project. Go to the Window menu at the top, click organizer, click the projects tab at the top, select your project and click the "Delete" button next to "Derived Data".
Clean your project. Product menu then "Clean" option.
Make sure that the old default image has been deleted from it's location in the file system (sometimes Xcode says it deleted something, but in actuality the file is still there on the file system).

Resources