iOS simulator only uses the first app folder for localStorage files but creates a new app folder for everything else - objective-c

I'm trying to delete the localStorage files of my app, and to do that I need to know where the app stores its cached data, but I don't consistently get the correct path in the iOS simulator, this only works consistently on the phone.
I think this has something to do with the fact that Xcode renames the app directory when you rebuild. If I delete the entire /Users/john_doe/Library/Developer/CoreSimulator/Devices/ and start the app NSSearchPathForDirectoriesInDomains finds the correct folder. On the next build the path that is returned is the new application directory, but the iOS simulator still uses the localStorage files in the old folder.
The code I run in Xcode to find the caches path: NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.CachesDirectory, NSSearchPathDomainMask.UserDomainMask, true).last as! String
tl;dr iOS simulator gives you a new application folder every time you stop and rebuild the app, but it uses the application folder from the first build for writing and reading the localStorage files.
Anybody have a workaround? A bug on this with Apple?

Related

React Native iOS No Bundle URL present but only when using a real device

I am trying to build a project that we have previously built many times on a real device through xcode but not it throws a No Bundle URL present error the moment the app boots.
I have tried updating the app, rebooting and updating the info.plist file but nothing seems to change it.
Other apps are booting fine.
I have my info and the error below.
Error Screen
Check whether you are running correct Project. Clean you build folder and then Run .
Seems like this is a common issue for some. I'd suggest checking out this thread with others that had a similar issue - What is the meaning of 'No bundle URL present' in react-native?

React-native JSON files being cached?

I am reading json files into a react-native app using require. For example:
myfiles.json:
const myfiles = {
one: require('./files/one.json'),
two: require('./files/two.json'),
three: require('./files/three.json')
}
export myfiles
However, I have updated my JSON files and the updates are not showing in the IOS simulator. I have tried closing the simulator and running react-native run-ios but it is still showing the old data from the JSON files.
Are these being cached somewhere? If so, where? What do I have to do to see the updates?
I suggest these ways to reset emulator and clean iOS build if you use xcode:
To reset the iOS simulator and erase all simulator data go to menu and Hardware -> Erase All Content and Settings
To clean the iOS build press Option+Shift+Command+K or go to Xcode menu Product -> Clean Build Folder. This will only clean cache for your current target
** After all uninstall your app on emulator and reinstall.

Music is not playing on release apk .using library react-native-track player

React naive app Music is not playing on release apk .using library react-native-track player.
It works fine with local host both in emulator and real device while debug mode.
Is der any specified place to keep mp3 files ?
I'm trying to load from bundle only
I'm a windows machine user
Please refer this git below you may clone it as well..
https://deva11#bitbucket.org/deva11/trackplayertest.git
Debug Mode :
Release Mode
in reference to react-native-sound .I am aware that music files should keep in android/app/src/main/res/raw folder and while bundling assets in react-native folders will be merging with android native folders.
How can I match it up ?
This issue has been fixed in 6c57395.
In release mode, React Native used to copy all resources into the drawable directory, and react-native-track-player used to look up the files there.
After an update, React Native started copying non-image files to the raw directory, and that broke the feature.
In case someone is looking for an answer, the proper way to load files from the device, is to prepend the path with file:///, here's an example:
TrackPlayer.add({
url: 'file:///storage/sdcard0/Music/song.mp3',
// ...
});
And the proper way to load files inside the app bundle is to require/import them:
TrackPlayer.add({
url: require('./song.mp3'),
// ...
});
If that doesn't work, feel free to open an issue in the react-native-track-player repository

Xcode's default projects folder missing

I'm quite new in iOS development and right now I'm watching tutorial videos. In them I see that every time a new project is created, Xcode suggests /home/Xcode as root destination where you can store your project. This folder has even a special icon with the Xcode logo on it.
On my Mac this folder is missing. I still can save the project elsewhere but even after re-installing Xcode that folder is missing.
Any idea how I can fix that?
The /home/Xcode folder is not the default location to store Xcode projects. The home folder is hidden by default on macOS so I suggest choosing a different folder to store your projects.
It does not matter where you save your Xcode projects. Save them wherever you want on your computer.

How can I force my app into the Applications/ folder?

I am currently developing a desktop app in OS X which has a requirement for Autostart on Boot. I have implemented autostart and it works well when I install my app and put it in the Applications/ folder, but I can't expect users to move the file. I am distributing the app using HockeyApp.
So I've started building .pkg files with Packages. This works great and was really easy, but fails to update when used in HockeyApp. After downloading the update, I get a message saying An error occurred while trying to extract the archive. Please try again later. [Cancel Update]
Things I have tried:
Signing the update
Not signing the update
Downloading the most recent version instead of updating (works perfectly fine)
Zipping the .pkg (Fails to upload to HockeyApp)
How can I force my app into the user's Applications/ folder? Should I just ask my handful of (technologically challenged) beta testers to delete their app and download the new version? Can I make a change to my .pkg method to make it work? Should I add code into the app which moves itself (Sounds hacky and painful)?
You cannot force the user to install into /Applications, however if you get the app to arrange the auto-start itself (for example via the App Preferences) then it should use the current location of the app (probably obtained from [[NSBundle mainBundle] bundlePath]) and that will work fine.
You might want to periodically check if the app has moved after this has been turned-on.