ApplePay canMakePaymentsUsingNetworks Always Returns False - ios

I am trying to incorporate ApplePay into my Cordova 7.0.1 application running XCode 8.3.3, but I can't get the code below to work. It returns false each time even though I have a mastercard and visa setup in my wallet. I have called CapitalOne and Citi to confirm that the cards are properly setup for ApplePay. Any advise to get the code to recognize the cards would be much appreciated!
supportedPaymentNetworks = #[PKPaymentNetworkVisa, PKPaymentNetworkMasterCard, PKPaymentNetworkAmex];
if ([PKPaymentAuthorizationViewController canMakePaymentsUsingNetworks:supportedPaymentNetworks]) {
NSLog(#"Supported card found");
} else {
NSLog(#"No supported card found");
}

Apple Pay was not turned ON in the Capabilities section of target settings in Xcode.

I think you can solve if you set martchant id in AppName.entitlements file.
If you already set martchant id in AppName.entitlements file, i wanna know how you made martchant id and certificate file.

I had a similar issue. Finally i found that i forgot to load Entitlements.plist file in iOS project setting. you can find more detail in
How to integrate Apple Pay in Xamarin Forms?
Hope this will help

Related

How to remove isAdvertisingTrackingEnabled In Unity

We have App in ios. It was developed in unity. Yesterday apple informed that our app has been rejected because we have been used advertising in your app. But we did not used any advertisements in our app. This is the screen shot.
we have been searching in google. but we have not found any solutions. So any idea how to remove the Isadvertisingtrackingenabled in unity.
strong textThose who have received the above error. I have followed the below steps and our app got approved.
The answer is taken from this forum
https://forum.unity.com/threads/important-changes-for-ios-kids-apps-action-needed-by-developers.838939/.
all the credit goes to that person only. I am just posting for information purpose only.
To make the manual fix, please follow the instructions below:
Open the file DeviceSettings.mm within your Xcode project.
Find and remove the line #include
Find and completely remove the function “QueryASIdentifierManager”
Find the function “UnityAdvertisingIdentifier” and replace it with:
extern "C" const char* UnityAdvertisingIdentifier()
{
return NULL;
}
UnityAdvertisingTrackingEnabled()
find the unityadvertisingtrackingenabled and replace the code.
extern "C" int UnityAdvertisingTrackingEnabled()
{
return 0;
}
NOTE:
In Package manager . Unity Ads and Unity Analytics are enabled as default. So kindly disable the both. and then following the above steps. it will works fine for me.
after following the above steps mentioned by this above forum . you will receive one error. So to avoid the error.Kindly add
SystemConfiguration.framework.
in xcode FrameWork Path.
Then the error will solved and your app also got approved.
if you some one need any assistance i am ready to help you.

Does LSApplicationWorkspace not work on iOS 11?

I have an app in private which need to scan all applications and schemes and get it by using private API LSApplicationWorkspace defaultWorkspace with others functional method, such as privateURLSchemes allInstalledApplications. This app works good and I can get all I need from the private API before iOS 11, but in this version I only got some warning and an empty array. It seems Apple limits private API that developer can't use in private in iOS 11.
So my question is what alternative ways can achieve my need in iOS 11?
UPDATE: This method does not work on iOS 12 - entitlement required
There is a way to find if a specific application is installed, its not a list of all apps like allInstalledApplications returned but its useful to query for a specific bundle id
Here is an example, the method receives bundle id and return true if it's installed on the device:
- (BOOL)checkIfAppInstalled: (NSString*)bundleID {
dlopen("/System/Library/PrivateFrameworks/MobileContainerManager.framework/MobileContainerManager",RTLD_NOW);
Class MBAppManager = NSClassFromString(#"MCMAppDataContainer");
NSError * error ;
id contentApp = [MBAppManager performSelector:#selector(containerWithIdentifier:error:) withObject:bundleID withObject:error];
return contentApp != nil;
}
Private API is just that—private API. Using it is completely unsupported, and as such, you cannot rely on a private API continuing to work in future versions of the OS.
In addition, I would be highly surprised if an app that used private API were able to get into the App Store, since it's one of the things Apple's reviewers scan for.
In enterprise you can use Apple Mobile Device Management (MDM) Protocol ManagedApplicationList commands to get the status of managed applications
From this post. From the comment of #ovo under the original question, it seems works.
Using MobileContainerManager.framework it's possible to check if an app is installed by using bundle id.
//If the device is iOS11
if ([[UIDevice currentDevice].systemVersion floatValue] >= 11.0) {
NSBundle *container = [NSBundle bundleWithPath:#"/System/Library/PrivateFrameworks/MobileContainerManager.framework"];
if ([container load]) {
Class appContainer = NSClassFromString(#"MCMAppContainer");
id test = [appContainer performSelector:#selector(containerWithIdentifier:error:) withObject:bundleId withObject:nil];
NSLog(#"%#",test);
if (test) {
return YES;
} else {
return NO;
}
}
return NO;
} else {
//Usual way
}
i got same Apple Reject.
Apple Says
Your app uses or references the following non-public APIs:
LSApplicationWorkspace
The use of non-public APIs is not permitted on the App Store because
it can lead to a poor user experience should these APIs change.
Continuing to use or conceal non-public APIs in future submissions of
this app may result in the termination of your Apple Developer
account, as well as removal of all associated apps from the App Store.
Solutions
To find out which library or code is causing this problem use the below code snipped.
1-) Open the terminal in macbook (cmd+ space) and than write terminal
2-) change the project directory with the below code
cd /Users/emreg/Documents/{your project url}
3-) To search appropriate word
grep -r LSApplicationWorkspace .
grep -r allApplications .
in my case, Blesh SDK has included LSApplicationWorkspace and allApplications keyword which is not permitted by Apple. When i upteded SDK, my problem is solved.
i hope, this answer will help someone.

Open Settings App from another App in iOS - React Native

I'm going through the docs in React Native and can only find navigating to external links from the app I am in.
I want to be able to navigate to the Settings app (more specifically to the privacy > location services page) but, can not seem to find the necessary information on it. There is the native iOS way of doing it which I am trying to replicate through React Native.
Is this possible?
I have tried the following to detect if there is a Settings URL. The console logs that the Settings url works however, it does not navigate to that page.
Update: thanks to #zvona I am now navigating to the settings page but not sure how to get to a specific deep link.
Linking.canOpenURL('app-settings:').then(supported => {
console.log(`Settings url works`)
Linking.openURL('app-settings:'
}).catch(error => {
console.log(`An error has occured: ${error}`)
})
You can access settings of the application with:
Linking.openURL('app-settings:');
But I don't know (yet) how to open a specific deep-link.
2021 update use:
Linking.openSettings();
otherwise your app will be rejected due use of non-public URL scheme
I successfully opened the settings by the code below, hope it's helpful :)
Linking.canOpenURL('app-settings:').then(supported => {
if (!supported) {
console.log('Can\'t handle settings url');
} else {
return Linking.openURL('app-settings:');
}
}).catch(err => console.error('An error occurred', err));
Reference: https://facebook.github.io/react-native//docs/linking.html
Since React Native version 0.59 this should be possible using openSettings();. This is described in the React Native Linking documentation. Although it did not work for me. When I tried quickly I saw a _reactNative.Linking.openSettings is not a function error message.
Linking.openSettings();
You can deep-link referencing the settings's index like so:
Linking.openURL('app-settings:{index}')
For example Linking.openURL('app-settings:{3}') would open the Bluetooth settings.
Linking.openURL('app-settings:1');
Adding an answer that worked for me and is easy to apply.
openSettings function in #react-native-community/react-native-permissions works for both iOS and Android.
Calling openSettings function will direct the user to the settings page of your app.
import { openSettings } from 'react-native-permissions';
openSettings();
You can import Linking from 'react-native' and then use Linking.openSettings() to trigger the call. This link explains it very concisely:
https://til.hashrocket.com/posts/eyegh79kqs-how-to-open-the-settings-app-in-reactnative-060
For example: to navigate under Settings/Bluetooth you have to use Linking.openURL('App-Prefs:Bluetooth');
For iOS 14 and ReactNative 16.13
You can use the most easiest way to open the app setting from react-native.
just,
import { Linking } from 'react-native';
and user below line anywhere you want open the app setting.
Linking.openSettings();
Old question, but this didn't work for me on Android and I found something that did. Hope this helps anyone looking for the same. :)
https://github.com/lunarmayor/react-native-open-settings
I don't have the ability to test it for iOS though.
Opens the platform specific settings for the given application.
You can handle your case using Linking from react-native. In my case, I accessed the touch id settings on IOS using:-
Linking.openURL('App-Prefs:PASSCODE');

I can't get HealthKit to work. Missing Entitlement

I am having a hard time to get HealthKit working for my iOS App. I have done all the steps I have found so far and none seem to solve my problem I keep getting this error when trying to authorize Healthkit:
Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x78fa24e0 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}
Here is my code asking for authorization:
if([HKHealthStore isHealthDataAvailable]) {
self.healthStore = [[HKHealthStore alloc] init];
[self.healthStore requestAuthorizationToShareTypes:nil readTypes:[self dataTypesToRead] completion:^(BOOL success, NSError *error) {
if (!success) {
NSLog(#"HK Error: %#", error);
[self presentHealthAlert:#"You didn't allow APP to access HealthKit Data. Please go to Settings and set up APP permissions." withTitle:#"Error"];
} else {
[self presentHealthAlert:#"Thank You For Access" withTitle:#"Success"];
}
}];
} else {
[self presentHealthAlert:#"Health Data Not Available" withTitle:#"Success"];
}
And Yes, I have enabled it on my project Capabilites, and yes I have enabled it in my Dev Center App ID. Is there anything else I might be missing?
I had this problem with a watchOS 2 app. The resolution was to ensure I had enabled the HealthKit entitlement for both the iOS app and the watch extension.
I had wrongly assumed the switch for the iOS app would be inherited by the watch extension.
You have to make sure that you click on your program on the left side of Xcode (the top of your file hierarchy). You'll come to a general settings screen in the main window (to the right) where you will see your bundle identifier, deployment target, and additional settings. Click on the tab at the top that says Capabilities. Now you will see a toggleable list which includes HealthKit. You have to activate it here before you can use it in the app.
Edit: Here is an image from Xcode that might help you find this if you're not familiar with setting dependencies or other program specific settings.
It is in this list on the right, towards the bottom you'll see HealthKit. It will check several things once you toggle it on and verify that you can use it.
A bit old, but for anyone else who has issues, I had to manually refresh my provisioning profiles as well in XCode 6.2 (Preferences -> Accounts).
I ended up here after reaching my wit's end. Nothing worked and I clearly had the HealthKit entitlement enabled so finally I just restarted the phone. Voilà. Restarting cleared the missing entitlement errors.
Click on the Watch App Extension target.
Tap on the Capabilities.
Scroll down to the bottom and turn on the HealthKit.
I managed to get my entitlement working by ensuring that I had a device registered. Once I got my iPhone showing under the simulator and I didnt have any unresolved issues under the identity section of the app it all loaded ok.
You may find that although you have turned on the HealthKit entitlement on in xcode that there is a second entitlements file that does not contain the healthkit boolean. I found that while the obvious entitlements file (at the top level) had the correct information, a different entitlements file had been created under Resources that did not contain the healthkit entitlement. fixing that file fixed my problem.

Paypal MPL iOS error

I am trying to integrate the PayPal MPL library into an iOS app. I have a UIViewController that is creating the PayPal button like so:
- (void)viewDidLoad
{
[PayPal initializeWithAppID:SANDBOX_API_KEY
forEnvironment:ENV_SANDBOX];
UIButton* paypalButton = [[PayPal getPayPalInst] getPayButtonWithTarget:self andAction:#selector(checkoutPayment) andButtonType:BUTTON_294x43];
[self.view addSubview:paypalButton];
[super viewDidLoad];
}
The app prints the following error message to the console a second or so after opening the ViewController.
Checking Error********************
Posting Error: 2147483647
DEVELOPER ERROR: This app isn’t using a supported version of the PayPal library.
I can't find anything about this error on Google, so here I am. Any ideas on how to fix it?
I am using xcode 4.5 and iOS 6 beta to test, and the 1_5_5_070_iPhone_DevelopersPackage version of the MPL library (the latest one on the website).
I also noticed that you have to have "bundle display name" in your info.plist
Without it you will get posting error as well
I know that this is very old, but there is one more requirement. It took me a while to find out. It must not be a very big integer. I've had a version string that was something like 20141014122113 (or YMdHms) and that also set this off. After having it shortened to 20141014 everything started working. So these appear to be the rules:
You must have a bundle display name
Just digits in build number
Build number must not be too long
The problem was that the Bundle Version in the Info.plist used alphanumeric characters. It seems the PayPal library reads it and expects it to be a number.

Resources