React Native iOS unable to locate sqlite database - ios-simulator

I am running WatermelonDB (which uses SQLite) on React Native. I am using the iOS simulator, and I am trying to locate the database file so I can query on it directly. It seems that I am able to successfully save to the database, since I can query data from within the app and it gets persisted.
Using htop, I have been able to find the running process of my application running on the simulator. However, when I cd into that directory, I see no .db file. I can even go to the root of all simulators ~/Library/Developer/CoreSimulator/Devices/ and ack for all db files, and still nothing shows up.
Next, I have tried launching the app in Xcode, as I have come across other posts that suggest checking the logs of Xcode, which is supposed to reveal the db location. Alas, this has shown me no information.
I am first interested to know how it is possible that anything at all is getting persisted, given that I cannot find a db file.
Second, should I be building my app from Xcode, or is it fine to use command line react-native run-ios? I can see that running this command uses Xcode under the hood, but I'm not sure if there are benefits to using Xcode. Nonetheless, using Xcode does not provide me with the answer I am looking for.
note: this is not a duplicate of this nor this, as I have followed all suggestions but have been unable to reach the conclusion

You can locate the watermelon.db files on your machine created by the iOS simulator by:
cd /Users/<your username>/Library/Developer/CoreSimulator/Devices
find . -name "watermelon.db"
This will show you the instances of watermelon.db files created by simulators. You can then take the output to an SQLite inspector and open /Users/<your username>/Library/Developer/CoreSimulator/Devices + {file path from find}.
If you have multiple results, then you may need to deduce which simulator is which by matching the ID to the simulator using xcrun instruments -s devices

Related

Unity deletes files itself from my asset folder on Mac OS

I've got a problem with Unity installed on Mac OS (Unity 2020.1.16f1 Personal and Mac OS Catalina 10.15.6)
It's look like Unity delete files by itself from my asset folder.
It occurs with both a Firebase (Firebase SDK 7.0.2) and PNG file.
The deletion seems to occur something like each hour (more or less)
However the problem don't happen with all my assets, for exemple with the Firebase SDK it seems that only the file FirebaseCppApp-7_0_2.bundle (and with my png file it happens only with a specific file).
Here's how I get the problem (exemple with Firebase SDK):
I import Firebase SDK I need into Unity (Import Package -> Custom Package and then choose the one I need)
Got this error: "DllNotFoundException: FirebaseCppApp-7_0_2"
Correct this error by going to Security And Confidentiality of my Mac and authorize Firebase to be open (when you download something from internet directly sometimes your Mac ask for this authorization because he don't recognize the developer)
Work perfectly for approximately 1 hour (I can make all changes I want, test my game with the game mode etc ...)
After 1 hour get the error of 2) again (on game mode)
I can fix the problem by reimport only one file from the SDK (FirebaseCppApp-7_0_2.bundle locate in Assets/Firebase/Plugins/x86_64/)
The first time I click play in Game Mode Unity crashes
Go to 3) step and continue
Is someone already get this error ? I've found multiple thread on internet talking about similar bugs (but not exactly the same) but nothing worked for me ...
I found and correct the problem. In fact the problem came from the iCloud which seems to not works correctly with Unity. For some obscur reason, the files which were deleted didn't sync with iCloud, and so when iCloud sent back the project the files were missing. You need to disable automatic sync with iCloud.
Some earlier versions of the Firebase SDK offered to add packages to the Unity Package Manager and would migrate files automatically. I would suggest using only unitypackage integration and trying to undo this migration in the process now. To see if this is the issue, do the following:
close Unity
open Packages/manifest.json and delete the entry for "ScopedRegistries" and remove any lines under "dependencies": { that start with "com.google. Note that Packages is a sibling of Assets (that is, it's next to rather than inside).
for safety, remove any Firebase packages under Assets. This include the folders:
Assets/ExternalDependencyManager, the (old) Assets/PlayServicesResolver, Assets/Firebase, Assets/Parse, Assets/Editor Default Resources/Firebase, Assets/Plugins/Android/Firebase, and Assets/Plugins/iOS/Firebase.
Download the latest Firebase Unity SDK (you can check the release notes here).
open Unity again and add each UnityPackage you need from the SDK. You can usually follow the errors in the console output if you've forgotten everything you're using.
A less likely issue you might be running into is MacOS's stricter behaviour with respect to gate keeper. There's a video here with a workaround, but since you mention the PNG files disappearing I expect that it's the External Dependency Manager.

Hot restart error with cannot copy ipa file

While I am aware that Hot Restart is in preview, it was for quite a while now and my testing never really worked since the first time I've tried it. I've waited for a few VS studio versions to come up, hoping that my issue will be fixed. Since I've kept an eye on issues and haven't seen something similar, I tend to believe that the issue is locally with my setup.
Here is the situation:
I've enabled Hot Restart in VS and added my account, picked the team (after I was added) and everything went fine without errors. I have a free apple account, but after I was added to a Team I was able to obtain automatic provisioning to work.
I've tried to set the debug build options similar to how the simulator was set
I've disabled device specific build as I saw in the docs that it can create problems.
I've installed iTunes just as specified in the docs and when I connect my device to my Windows 10 PC, I can select it from the list.
So basically it looks like everything is set up. I use for testing an iphone 7 with latest iOS version.
Here is what happens:
I've selected different types of output logs hopeing to catch some error in there that could lead me to find a solution.
when starting to build I can see "Building offline for a local device" and I can see my provisioning file details on "Detected signed identity"
I see no apparent error while it compiles and does its job, no complains about signing
then it gets to the IpaCopyToStagingDirectory and there it starts to copy a bunch of files from bin\Iphone\Debug to Artifacts\app.iOS.dSYM where I get the final error: Could not copy the file bin\iPhone\Debug\\app.iOS.ipa because it was not found
If I go to the bin folder, there are many files, including app.iOS.exe, but indeed there is no ipa file. I also don't know why it has two \ on its path.
Any ideas why is not working?

Install claimed to have succeeded, but application could not be found on device Xcode 11

Just after switching from Xcode 10 to 11, I am unable to install my app on any device
The error at launch time after installation succeeded says :
Install claimed to have succeeded, but application could not be found on device.
Details says :
Could not locate installed application
Domain: com.apple.platform.iphoneos
Code: -1
Recovery Suggestion: Install claimed to have succeeded, but application could not be found on device. bundleId = myBundleId
--
Installed application was not present in database of installed apps after multiple lookup attempts.
Domain: com.apple.platform.iphoneos
Code: -1
However everything works fine on a simulator.
I tried to delete derived data, clean project, delete the app ..
Very strange : After submitting the app to testlfight I can download it and it works.
But when I build a new app to Xcode it launch the app just downloaded from tesflight and not the version pushed via Xcode ..
For me, it's a problem with ipatool.
Here's a way to find out details why it failed to create a proper iPhone App (.ipa) file from the build output/Xcode archive:
Go to Product > Archive, then open Window > Organizer > Distribute App.
It should show you "IPA processing failed" with a big red error symbol.
Now, open the logs and search along these lines:
timestamp Assertion failed: Expected n archs in otool output:
and
timestamp /Path/to/ Xcode-beta.app/Contents/Developer/usr/bin/ipatool exited with 1
While this can't be the final solution, try removing all problematic libraries mentioned in the logs between the two lines until ipatool exists successfully.
I also had this issue/error message. I realized that I had automatic signing deactivated and I had selected a provisioning profil with a distribution certificate.
Solution:
So if you want to run the app on your iphone directly from Xcode (not through testflight) you have to make sure you use a provisioning profil with a developer certificate.
This is probably not the case for most people facing this issue, but I faced it once several days ago and easily dealt with it by cleaning the build folder and switching to a legacy build. The second time I faced it, none of the suggested solutions seemed to be working.
I then noticed that because I'd almost run out of storage on my device, iOS had "offloaded" almost all of my apps. If there is a small cloud under your apps and the app needs to "install" again before launching, then this is the case with your phone too. Trying to launch all of the apps that I don't use regularly (so I never noticed the little clouds) "reinstalled" all of them and solved the issue entirely. Maybe this helps someone facing this for similar reasons.
I have the same problem,I modify the project setting
File --> Workspace Setting --> Build System --> Legacy Build System
it's OK for me
I also got this alert. That's because i run the app in release Build Configuration, but with a appstore Provisioning Profile . It's not allowed. So i change the appstore Provisioning Profile to a dev Profile. Then everything is ok.
Hope this can help you.
I found a way to solve this problem. After I upgraded iOS 13.1, the real machine also ran. Later, I found out that because I had archive operation the day before, the real machine running certificate changed from distribution mode to development mode and everything worked normally.
For my case (xcode 11, ios 12.4), change the Bundle identifier can solve this issue...
Before changing Bundle id, I've tried
using beta xcode
deleting app on iphone
deleting derived data
cleaning project
reopen xcode
Here's another solution. I had previously installed three other apps using XCode and got this error message when I tried to install a fourth.
I simply deleted one of my three existing apps (after hours of hair pulling and SO searching) and tried again. It worked.
Platform: iPad 2018 on v13.1 with XCode v11.1,
I was using different signing team/certificate for ...Tests target.
Setting the same for main target helped.
Update pods if you have.
pod update
just it.

iOS Xcode 10 How to fix broken "New build system" - build.db: database is locked Possibly there are two concurrent builds

I'm having problem with the infamous:
"/Users/n/Library/Developer/Xcode/DerivedData/Build/Intermediates/XCBuildData/build.db":
database is locked Possibly there are two concurrent builds running in
the same filesystem location
How do I fix broken "modern" build system getting stuck with a locked database?
I tried:
Cleaning the project
Deleting derived data
Updating cocoapods (sudo gem...) and pod install
Full nuking of Xcode folder with a fresh reinstall from App Store
Now I'm with a fresh Xcode installation, the project worked for a dozen builds(real device and simulator) and the problem comes back, making me unable to work on a project. How I can reset the locks on build.db or delete it?
I see this question asked multiple times, and the answers do not solve my problem. I'm not using build scripts, all I have is a couple cocoapods. Please do not close this question, as I'm asking specifically about lack of:
NO CUSTOM SCRIPTS
NO CONSOLE BUILDS
NO COMPOSITE TARGETS
The only thing that lets me continue working is turning to the legacy build system:
How can I use the legacy build system with Xcode 10's `xcodebuild`?
Xcode 10: unable to attach DB error
I encountered this when tinkering with cli, swift run democli. The error I got was:
unable to attach DB: error: accessing build database "/Users/xman/Desktop/democli/.build/x86_64-apple-macosx/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.
I just remove the build.db, and the DB error is gone.
So far the only way to fix this is to turn the "Legacy Build system" on in File > Workspace settings. After certain number of computer restarts (or time elapsed?) the setting can be changed to the "new" build system again and it will build.
I managed to compile my project by adding to the xcodebuild command line:
OBJROOT="${OBJROOT}/DependentBuilds"
Thanks to this post: https://github.com/mattgallagher/CwlSignal/issues/24#issuecomment-396931001
I encountered the same issue while using Fastlane and the New Build System.
After switching from xcodebuild( ) to build_app( ), the issue was resolved.
The legacy build solution is too temporary. You can only use that from within XCode. You can't use it within VSCode, so you lose the Hot Reload sweetness.

How to clone a project with Xcode to a local volume

I am attempting to clone an XCode project using the Organizer. I am following the example apple gives to a tee (http://developer.apple.com/library/ios/#recipes/xcode_help-repositories_organizer/articles/cloning_repository.html). My location path is /Volumes/Share/Projects/XCode Using Finder I verified that Share/Projects/XCode exists and that I have read + write access to it. However, whatever I attempt, XCode invariably returns a "host is unreachable" error.
Btw, all my attempts to whatever folder (local or shared) are failing. I must be missing something really basic but can't seem to figure it out.

Resources