How do you add Settings.bundle to a phonegap app? - ios

we have implemented a phonegap application using Typescript, Angular, css etc. We use PhoneGapBuild to package this up and deploy to iPads.
I would now like to add some settings for this app in the iPads settings application - currently, this only shows the permission items like camera, notifications etc.
I have managed to use the cordova plugin "me.apla.cordova.app-preferences" to set and fetch application preference values... but these are not being shown in the Settings app.
Investigating further, I believe that you need to create a Settings.bundle folder with the Root.plist file inside... which I have done (I actually created it using xcode and copied the resulting files into the root of my phonegap project (next to the config.xml))... and still after a PhoneGapBuild and re-deploy nothing appears in the Settings app for my application. Upon inspection of the .ipa file... the Settings.bundle is location in the www folder... is this correct?
So could someone please tell me the baby steps required to get settings to appear in the Settings app for this type of project.

Related

React Native application doesn't show up on settings in iOS

My config:
react-native: 0.66.3
xcode: 13.2.1
When deploying an application to the simulator, or to real device, I cannot access the settings page of the app in iOS.
I have a button that asks for user location, and I should at least see it on the settings page.
I tried to deploy the application on release variant, but same thing.
I checked some solution on the web, and I found a solution with many upvote but it still did not do the trick.
Maybe there is a way to generate a Settings.bundle with cocoa based to the permission that we have ?
In my case, I came across this and I followed these instructions :
Adding the Settings Bundle Open your workspace inner ios folder with
xcode To add a Settings bundle to your Xcode project: Choose File >
New > New File. Under iOS, choose Resource, and then select the
Settings Bundle template. Name the file Settings.bundle.
My application was available on the Settings application on iOS, and I just updated the file with my permissions.
From now, the purpose of this file is to manually add some permission, or information (like the version code).
But the automatic permissions like geolocation will be added automatically.

App settings not present in system settings in iOS

I've created a flutter app. One of the functionalities I'm creating requires location access and once the user denies the permission there's no way to enable it manually and system doesn't display dialogs on subsequent requests.
The reason it can't be done manually is that there's no application entry in system settings (at least in iOS simulator - that's the only iOS instance I can test on myself). What do I do to make it appear?
iOS uses settings bundle to display applications in system settings. Turns out Flutter is not creating it upon project creation.
In order to create it:
Open ios folder in xcode
Open Runner entry in the project view, it should contain a bunch of folders, one of which is Runner again
Right-click the inner Runner entry
Select New file...
Select Settings Bundle and confirm the selection (then press create with default settings)
Open Root.plist file and remove all Preference Items so that the array is empty
Once you reinstall the app, an entry in settings should appear. Once you request some permission (e.g. location) and deny/approve it, it should be automatically added there.

Dont see settings in xcode project

I'm doing an app and i try to have a setting that the user would be able to change from the iOS Settings page,
i opened a new settings.bundle in my app
and kept some of the default values, but i dont see it in my actual device settings
i tried reinstalling that app many tines, and i still dont see the app settings in my settings options on my iOS
here is my settings i created:
i kept the default values in the Root.plist
but also on the simulator and also on the actually device i dont see anything on the settings
what am i doing wrong ?
From the official docs at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/UserDefaults/Preferences/Preferences.html:
A Settings bundle has the name Settings.bundle and resides in the
top-level directory of your app’s bundle. This bundle contains one or
more Settings page files that describe the individual pages of
preferences. It may also include other support files needed to display
your preferences, such as images or localized strings. Table 4-2 lists
the contents of a typical Settings bundle.
So renaming your settings bundle to Settings.bundle should fix the problem.

How to edit the Xcode Project for Meteor iOS integration?

I want to create an app icon, splash screen, edit the app name, and set some cordova / app settings.
meteor run ios opens up the simulator but doesn't open or the project. Where is that project and does this Xcode project ever get overwritten? I don't want to lose any settings I make.
For example I want to set the app url scheme so I can implement a redirect to the app. I also want to set cordova preferences to disallow over scroll. Typically I would do these things from within the .xcodeproj but where is it and when does it get overwritten / reset?
From what i have seen from the docs and my experience so far
meteor run ios only runs the iOS emulator with your code in it. The code related to this build is in .meteor/local/cordova-build but is temporary and will get overwritten all the time
meteor run ios-device -p yourlocalip:yourlocalport will launch XCode with the cordova-built .xcodeproject, and a local server on your computer. It is intended to make you able to run and debug your code from an actual iPhone device, with the changes you make on your computer to the code repercuted instantly on the iPhone screen. You need your computer and your phone to be on the same Wifi to enable this feature. The code related to this build is in .meteor/local/cordova-build but is temporary and will get overwritten all the time
meteor build /Path/To/Builds/Directory/NewBuild -p yourserverhost:yourserverip will actually create the cordova-built .xcodeproject pointing to your real server at the path you specified. From this project you can customize as much as you want BUT you will indeed loose these settings with a new build...
Except if you use the yourproject/cordova-build-override/ folder !
As described in the offical cordova meteor docs under "Advanced build configuration" everything you put in this folder will overwrite the files created by meteor during its build. So you can configure everything in the Cordova/Phonegap way there. If you were able to configure your features through Cordova usually, you will be able to do it there.
Bonus that I have learned the hard way :
Always destroy the .meteor/local folder before building one of those three things, i got stuck in a state where XCode remembered some of my changes to the .xcodeproject and everything was messed up. After destroying this folder, everything went back to normal :)
hope i helped
Mickael
If you are looking for the path to the Xcode project in your filesystem, it is located at:
/path/to/project/.meteor/local/cordova-build/platforms/ios/<project>.xcodeproj
You'll have to navigate to your project directory and open .meteor because it is a hidden file.
Note: If you want to be able to see hidden files in finder on a mac, then type into your terminal defaults write com.apple.finder AppleShowAllFiles TRUE, and then restart finder. Change TRUE to FALSE to only see visible files.

Why PhoneGap always shows default splashscreen image?

I'm testing a sample iOS app now, although I set all new launch images in Xcode (Summary tab of Project Target screen), PhoneGap 3.0 keeps showing its default splashscreen. Why? even when splashscreen is a plugin and not included by default in PhoneGap 3.0 now.
iOS document say about launch images but not splashscreen, and it even strongly recommend us to use a "first screen" similar as launch image, not something like about screen. Are these same?
It's not about cleaning or caching issues at all. The problem is PhoneGap includes all possible launch images in project template by default. These files are under Resources folder and copied to bundle's root folder on build event. Although I properly selected my own launch images in Xcode (Target/Summary screen), default PhoneGap's specific files e.g. Default~iphone.png overridden my files :(
Once issue is identified, you can fix it someway, but I prefer below steps:
Delete all default icons and splashscreen files under /platforms/ios/AppName/icons and /splash folders. You surely don't need these placeholder images.
In Xcode, select Targets/AppName, then tab Build Phases, delete all file names of images in the above step in section Copy Bundle Resources.
Add your own images files for app icon and launch images here.
Edit Info.plist file (file AppName-Info.plist under /platforms/ios/AppName/) to include your images, you will need to use CFBundleIcons and UILaunchImageFile keys. Go to iOS developer site for reference.
Splashscreen and launch image are the same thing.
You probably did everything right but iOS (especially in the simulator) often just doesn't change those things (splashscreen, icon etc.) during development process. Try to delete your app, clean your project (in Xcode: Product -> Clean (shift+cmd+k)) and reinstall your app.

Resources