How to add NSPhotoLibraryUsageDescription, NSCameraUsageDescription, and NSMicrophoneUsageDescription to info.plist for react-native-image-picker - react-native

I'm new to xcode and react-native. I'm trying to use react-native-image-picker to add a user profile (uploaded to s3). react-native-image-picker's getting started assumes you have knowledge of info.plist. I'm not 100% sure how to proceed given:
For iOS 10+, Add the NSPhotoLibraryUsageDescription,
NSCameraUsageDescription, and NSMicrophoneUsageDescription (if
allowing video) keys to your Info.plist with strings describing why
your app needs these permissions
I know the info.plists are found in the ios folder, but
which info.plist do these permissions need to get added to (there's multiple inside ios folder: build, RNapp, RNapp-tvOS, RNapp.xcodeproj, etc)?
how does the XML look?
Should this be happening in xcode instead of my text editor?
docs

if you don't providing the privacy key in Info.plist, then your app is crash. You can see its log why crashed.
You will find these code below in the info.plist of your xcode , open in text editor.
adding these will grant the permission for using camera, PhotoLibrary, Video
<key>NSCameraUsageDescription</key>
<string>${PRODUCT_NAME} Camera Usage</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>${PRODUCT_NAME} PhotoLibrary Usage</string>
<key>NSVideoSubscriberAccountUsageDescription</key>
<string>${PRODUCT_NAME} Video Subscribe Usage</string>

add ti info.plist
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo Library Access Warning</string>

You want to edit the plist that you need the permissions for. If you are making a mobile app that would be: RNapp.
You could do this in a text editor but the easiest way to do it is in Xcode.
Open the plist, on the last item (making sure it is not expanded_ hit the + button to create a new row to provide a key to define a value for. Xcode should autocomplete on the keys you provided above and set the value to the appropriate type.
Hope this helps.

Related

adding keys to info.plist in Xcode

And yet, another glaring hole in my knowledge about developing things pops up..
But, after some internetz, I find that in order to make geolocation work in react native apps, I need to:
You need to include the NSLocationWhenInUseUsageDescription key in Info.plist to enable geolocation when using the app.
that makes sense, this is the bit that makes the native tools talk to the js framework (I think).. but how do I add a value to that plist file? What does that key look like?
After pressing on the plus button marked in red circle search for
=> Privacy - Location When In Use Usage Description ... Then you will have to add a description right beside it
This should be your result
PS make sure you open info.plist as property list to implement the way i'm showing.
Hope this helps !

Wallet pass fails to display if it has no images

I am trying to create an ios Wallet Event Ticket. I managed to give all the info I needed to create the pass.json and I have signed and zipped it. When I try to open this on a Mac, I am able to see the pass in the preview. When I email it and try to open it from an iPhone, the screen just goes to the main screen as if it crashed.
After lots of experimentation I found out that if I add at least one of t he images (icon) I am able to see it in preview and add it to the Wallet.
Since I do not care to add any image, this seems way too much just to make it work.
The question is, are images required in the pass? And if not, why does it not work without them. I repeat, it was displayed on Mac preview either with or without the image file.
Yes! manifest.json required the image correctly, moreover the pass.json also need to ensure everything is correct. Some elements must add in json for iPhone open, for example:serialNumber, webServiceURL, authenticationToken, relevantDate
Also, iPhone open .pkpass as difference format with mac. In my case , the signature file is wrong will also make the .pkpass file cannot open in iPhone.

App name appears as Xcode project when downloaded but is different on app store

I recently released a new build of an app to the app store a bit ago. On iTunes connect I set the name which is displayed on the dashboard and in the app store, but when downloaded on a device, the name is the same as the original Xcode project on my computer. What is up with that? Is there something in the plist I need to change?
Many thanks.
AFAIK, you have to change the bundle name in info.plist. It's default is $(PRODUCT_NAME). And this product name is the one you put while creating the app in XCode at the beginning.
The App Store data is taken from the info you uploaded in iTunesConnect.
Also, if this varies widely then your app might got rejected. Check the guideline 3.4. About 2% of apps get rejected for this, check here.
The name that should be displayed on the device itself is defined on the plist in XCode in the Bundle Display Name field. The name that's displayed on the App Store is defined on iTunesConnect in the App Name field.
The two fields don't affect one another but they should be similar enough so that Apple's review team won't reject the app.

Editing Info.plist possible programmatically?

I have set my Facebook-AppId in the Info.plist. But I wish to edit it because its dynamic.
How shall I do it programmatically?
Probably write in info.plist is not good idea and it doesn't work because you are trying to write the dictionary to a .plist file inside your App bundle, which is read only. Thus it would not work and also would have more rejection chances even if you get it done other way.
BTW why Info.Plist only? I mean why you can not have it in other way e.g nsuserdefaults or sql
You can't edit the Info.plist of your app. You don't have write access to that file (assuming you want to release this on the App Store).
The only way to write a plist file is to copy it from the bundle to the document folder of your app.
After that you can write. Here is a good tutorial but there are much more. Just google.
http://ipgames.wordpress.com/tutorials/writeread-data-to-plist-file/

NSUserNotification don't show application icon in notification [duplicate]

I'm using OSX's Notification Center APIs for the first time and can't seem to figure out how to make my app's icon to show up in the Notification badge.
The default "your app doesn't have an icon" icon keeps showing up:
Here's what I've done so far
I have created an icns file that includes 512, 256, 128, 32 & 16px versions
dragged the icon into the "App Icon" section of the target's summary
I made to sure to check the box to copy the icon into the project
the plist's "Icon file" section references the correct icon name (minus the .icns) part
Any ideas? The icon doesn't show up when I run the app thru Xcode or when I export an archive either.
I also have extracted the Sparrow.icns file from Sparrow.app and tried using that one instead of the one I made. That didn't work either.
I was able to fix this issue by incrementing the Build number in the General section for the build Target.
You can force the Notification Center to refresh all of the icons by deleting the Notification Center database file (~/Library/Application Support/NotificationCenter/SOME_UUID.db) and then killing the Notification Center process (e.g., from Activity Monitor).
Unfortunately this has the side effect of deleting your notification history, but this wasn't too much of an issue for me.
There's actually an ongoing debate on Apple's developer forums (link, link for people with access) about this. As far as I know, there's currently no real solution, but you can try the following:
Change your app's bundle ID and try it again. If you change it, clean your app, and change back, some people have reported success with seeing their icon show up.
Log in as another user. The caching Notification Center uses may be per-user, so you might be able to get the properly-iconned notifications as a different person.
The folder location has been moved for OSX 10.10+.
Following command takes to you to its new location:
$ cd `getconf DARWIN_USER_DIR`/com.apple.notificationcenter/db
and then
$ open .
Easiest way that I managed to get the icon to show up is change the Bundle Identifier in your project. This works on OSX 10.10.5 and XCode 7.2
(Once notification center picks up the change, you can change it back to your original bundle identifier if you already have a provisioning profile associated with it)
I have solved the issue by archiving my app and adding a copy to my applications folder. When the app is in Application folder, the icon is always visible even you run the app from XCode...
I tried all of the above suggestions but the only thing that worked for me on 10.14 was to delete DerivedData:
rm -rf ~/Library/Developer/Xcode/DerivedData
If anyone still having this issue, and none of the methods above worked, here is how I solved it:
open Notifications from the System Preference (easiest is to open Alfred or spotlight and type Notifications)
find your application and remove it (press backspace/delete button)
NOTE: this may remove all notifications
I am using Xcode 11.5 and I had the same problem. In my case tough, it was sufficient to clean build output, close and reopen the project. Then do a fresh build and let it run again. The icon was there afterwards.
Side note: I've placed the app icon for every size in the assets.xcassets file, except 1024 x 1024 pixels. Don't know if this is relevant or not. Hope that helps.