What is the way to update info.plist with the URL Scheme when using branch.io? - url-scheme

I am reading conflicting information so unsure what to do.
According to this document: https://help.branch.io/developers-hub/docs/ios-basic-integration#2-configure-associated-domains
I need to submit a URL Scheme. Recommendations? Apple says reverse DNS.
According to this document: https://branch.io/glossary/uri-schemes/
URL Schemes are obsolete.
What should I do?

A Branchster here -
While most of the redirection happens through Universal Links on iOS there can be certain situations where a third-party app is not able to trigger UL and in that case, the fallback redirection using URI schemes comes into the picture.
Ideally, you should set up both Universal Links and URI schemes in your Info.plist file so that you cover all the edge cases. You can check out the recommendations for the URI scheme here though just ensure it is something unique to your app.
To start you need to configure your Branch Dashboard enabling Universal Links toggle and entering your URI scheme and app information -
You can then proceed to enter the same information in your project's Info.plist file -
<key>branch_universal_link_domains</key>
<array>
<string>sample.app.link</string>
<string>sample-alternate.app.link</string>
<string>sample.test.app.link</string>
<string>sample-alternate.test.app.link</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.your.schene</string>
</array>
<key>CFBundleURLName</key>
<string>com.branch.monster</string>
</dict>
</array>
<key>branch_key</key>
<dict>
<key>live</key>
<string>key_live_</string>
<key>test</key>
<string>key_test_</string>
</dict>

Related

Possible unhandled promise rejection (id: 0)

I've been having this problem for over a month now, this error occurs whenever I try to login to my react-native app using a mobile device.
This is the error
And this is the code to login in my react native app
There's this part of the docs you need to take note of. What you are missing is adding an App Transport Security exception, since you are not using localhost as server, and https is required.
By default, iOS will block any request that's not encrypted using SSL.
If you need to fetch from a cleartext URL (one that begins with http)
you will first need to add an App Transport Security exception. If you
know ahead of time what domains you will need access to, it is more
secure to add exceptions only for those domains; if the domains are
not known until runtime you can disable ATS completely. Note however
that from January 2017, Apple's App Store review will require
reasonable justification for disabling ATS. See Apple's documentation
for more information.
An example of ATS is as follows, in info.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>example.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
For android, similarly from docs
On Android, as of API Level 28, clear text traffic is also blocked by
default. This behaviour can be overridden by setting
android:usesCleartextTraffic in the app manifest file.
You can refer to https://developer.android.com/guide/topics/manifest/application-element#usesCleartextTraffic
If you are using some api that is hosted on some server. It must have https because in latest devices http request is forbidden.

Safari extension background script by default not allowed to access sites in SFSafariWebsiteAccess in Info.plist

I'm developing a Safari extension and need the background script to be able to use the browser.webRequest.onBeforeRequest API when certain pages are loaded (let's say, example.com pages).
I have this in my manifest.json:
...
"permissions":["*://*.example.com/*"]
...
And I have this in the Info.plist for the extension target in my macOS app:
...
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.web-extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string>
<key>SFSafariWebsiteAccess</key>
<dict>
<key>Level</key>
<string>Some</string>
<key>Allowed Domains</key>
<array>
<string>example.com</string>
</array>
</dict>
</dict>
...
The extension is working except that the extension does not by default have access to example.com pages. When I build the extension in Xcode and load it in Safari, then go to Safari > Preferences > Extensions > My Extension > Edit Websites, example.com is listed under "Configured Websites", but with the Ask option selected. If I update it to Allow, the extension works as expected.
How can I configure the app such that the extension automatically has access to example.com pages when the user activates it? I've seen other extensions that have access to webpages automatically, but I don't know how they do it.
Many, many thanks for your help!
Documents reviewed:
https://developer.apple.com/documentation/safariservices/safari_app_extensions/safari_app_extension_info_property_list_keys/adjusting_website_access_permissions
https://developer.apple.com/documentation/safariservices/safari_web_extensions/managing_safari_web_extension_permissions
It appears that that's the default and can't be changed. Safari simply handles the hosts in permissions as suggested websites rather than pre-approved websites. The user has to manually enable each website in the options or via the "browser action" button.

Issue in Updating App to appstore with Associated Domains enabled

While uploading app to Itunes Store I am getting following error, can any one please help me solving this?
My app supports Deeplinking and Universal Linkings via Website and Emails so I have added associated domains in my Capabilities file.
ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application
bundle's signature contains code signing entitlements that are not
supported on iOS. Specifically, value 'applinks:www.some-app.com/*'
for key 'com.apple.developer.associated-domains' in
'Payload/myapp.app/myapp' is not supported."
I can not disable this option as this is required for my app.
Hi there and welcome to StackOverFlow. It looks like the syntax for the entry is incorrect.
'applinks:www.some-app.com/* is not a correct entry as you can only define domains and not paths in the associated domains entry. Please correct it to 'applinks:www.some-app.com' and give it a try.
As per Apple's docs, you must specify the paths etc. in the site association file: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html
There you can specify the regex/path pattern.

OSX/Cocoa : setting up service in menu for right click and services list

I have followed all the Apple documentation for setting up a service for a right click menu list and for the services list:
I have made all the relevant info.plist entries. (send types, port name, menu title, instance method, etc.)
I have created the method which handles services.
I have added service registration code in the app.
I built my app, put it in the application directory, logged out and back in.
Despite all this I cannot see my service in any menu item.
EDIT**
Here is the services part of my info.plist:
<key>NSServices</key>
<array>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MyApp/Send to MyApp</string>
</dict>
<key>NSMessage</key>
<string>contentService</string>
<key>NSPortName</key>
<string>MyApp</string>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
<string>NSFileContentsPboardType</string>
</array>
</dict>
</array>
What am I doing wrong? thanks in advance.
I have followed all the Apple documentation for setting up a serviceā€¦
Ah, that's the problem: You stopped there. You also need to add the NSRequiredContext key to your service to get it to be enabled by default on Snow Leopard and later.
Fortunately, while the Services documentation doesn't mention that NSRequiredContext is required, the Information Property List Key Reference does explain the value you must provide for it.

how to register the app to open the pdf file in my app in ipad

i want to open the pdf file in my app from pdf page,
but i am not getting any option of opening the pdf in my app.
this my info.plist file
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeIconFiles</key>
<string>Icon.png</string>
<key>LSItemContentTypes</key>
<string>com.neosofttech.pdf</string>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.pdf</string>
</array>
<key>UTTypeDescription</key>
<string>PDFReader File</string>
<key>UTTypeIdentifier</key>
<string>com.neosofttech.pdf</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>pdf</string>
</dict>
</dict>
pls tell me where i am wrong in this, how can i open the pdf file in my app.
I'm assuming that you're trying to open an attachment from within Mail based on your plist here. Since you don't own the PDF file type you can't declare it as an exported type. You only need to declare it as a supported document type.
For example:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
</array>
You can find a list of all of the system supplied content types here or in UTCoreTypes.h.
When someone does open a PDF file and chooses your application that file will be copied to an Inbox subdirectory of your Documents folder in your app sandbox. Your app will then be opened and within your app delegate's application:didFinishLaunchingWithOptions: your launchOptions dictionary will contain a UIApplicationLaunchOptionsURLKey key specifying the URL of the file within your sandbox that you can then work with.
You can't do what you're trying to do unless you do the following:
Register a custom url with the system
Call that custom url from within a hyperlink inside the PDF
Generate a PDF with clickable links
So what this means is that you register a custom url handler in your info.plist. For example, let's say you create a custom url handler with the form coolapp://. Now, inside of your document from which you generate the PDF, when you create a hyperlink, have it use your custom URL, for example coolapp://filedetails?pdfurl=mywebsite.com/path/to/pdffile.pdf&pageno=5. You then have to parse this in -application:handleOpenURL:. Download the file specified in the pdfurl field and then jump to the page specified in pageno.
Keep in mind that this assumes you are creating the PDF in question yourself. If you do not control the PDF content creation process, you cannot do what you are wanting to do. There is no way to open your app from an arbitrary PDF. It has to be done using a custom URL.
Let me know if you need clarification.
Insert code below to info.plist
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>"*"</string>
</array>
<key>CFBundleTypeName</key>
<string>Unknown</string>
<key>LSItemContentTypes</key>
<array>
<string>public.data</string>
</array>
</dict>
</array>
Old post - but I landed on here also looking for a way to pass a PDF to my App.
The plist depicted by Ashley Clark help me to register my App as an App that can take a PDF file as a parameter. +1 for him on that one :-)
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
</array>
However, to fully implement this, I used the following method in my AppDelegate.m file:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
NSLog(#"sourceApplication: %#", sourceApplication);
NSLog(#"url: %#", url);
The above runs when the App is opened as I was running Safari and had a PDF that I wanted to share from there.
Above, I can determine which App passed my App the PDF and the URL to it's location.
When run, it outputs the following:
sourceApplication: com.apple.mobilesafari
url: file:///Users/me/Library/Developer/CoreSimulator/Devices/C395439F-7A0D-434F-8D78-D4615DB643E1/data/Containers/Data/Application/E3B181BC-6075-4F2C-923D-2ECC642DA555/Documents/Inbox/pdf-5.pdf
I can then use the URL to open the PDF and do whatever I want with it in my App.