Ionic:
#ionic/cli: "^6.10.0",
Ionic Framework : "#ionic/angular": "^5.1.1"
#angular-devkit/build-angular : 0.1102.13
#angular-devkit/schematics: "^9.1.7",
#angular/cli: "^9.1.7",
#ionic/angular-toolkit: "~2.0.0",
System:
NodeJS : v12.14.0
npm : 6.13.4
OS : macOS Big Sur version 11.2.3
Xcode : Xcode 12.4 Build version 12D4e
In the need to activate in-app-purchase in an Ionic/iOS app, I built my product in App Store Connect for test.In the need to activate in-app-purchase in an Ionic/iOS app, I built my product in App Store Connect for test.
enter image description here
I developed an Angular / Ionic application with online payment and I created an ios application and when I sent it for verification it was rejected by Apple requiring to integrate "in-app-purchase", that is is why I used the Plugin "In-App-Purchase2" to manage the purchase But when I try to access the package I created, XCode launches the following logger: "Undefined" or nothing display .
I don't understand why I can't find my product (my product list is empty), I noticed that there is no connection between my app and AppleStoreConnect ..
Could you help me find out if the method I am using was good and why it is not working well.
My Code :
Pasted Graphic 4
Pasted Graphic 3
Log Xcode
Loadina network plugin
Applications Agreement is signed
Capture dβeΜcran, le 2021-06-11 aΜ 12 24 03
Ps: i tested it in simulator
Hi #Juliana welcome to the community! Lets help you with a snippet code. You need to be sure the Store is ready before ask to handle the products, and use NgZone to get the products data.
constructor(private store: InAppPurchase2){
this.productId = 'my_product_name'
}
ngOnInit() {
this.platform.ready().then(() => {
if (this.platform.is('ios')) {
this.setupPurchase();
}
});
}
setupPurchase() {
this.store.verbosity = this.store.DEBUG;
this.store.register({
id: this.productId,
type: this.store.NON_CONSUMABLE
});
console.log('verbosity ππ½ ', JSON.stringify(this.store.verbosity));
this.store.ready(() => {
this.registerHandlersForPurchase(this.productId);
});
// refresh/store purchase
this.store.refresh();
}
registerHandlersForPurchase(productId) {
// Approved
this.store.when(productId).approved((product: IAPProduct) => {
console.log('Approved ππ½ ', JSON.stringify(product));
// Product Finish
product.finish();
});
// User closed the native purchase dialog
this.store.when(this.productId).cancelled((product) => {
console.error('User Canceled! ', product);
});
this.store.refresh();
this.product = this.store.get(this.productId);
if (!!this.product.id && !!this.product.priceMicros) {
this.zone.run(() => {
// Use on HTML view to show the products
this.displayProduct = this.product;
});
}
console.log('Handlers produto ππ½ ', JSON.stringify(this.product));
// Track all store errors
this.store.error( (err) => {
console.error('Store Error ' + JSON.stringify(err));
});
}
Please, adapt it to your code and run on native device. You will see the console.log() on debugging with the errors and status of the products.
Related
We are using IOS file upload dialog in order to use video files with our service using react.
All video files are working in android platforms and all browsers in linux and MacOS. However, when we use video files with upload dialog in IOS IPhones such as Iphone 14 Pro Max, then the compress process starts and following that the dialog rejects the video file.
We have been debugging with browserstack using a real phone in a simulator, however no luck until this point.
When we select the file, it firstly runs a compression activity then changes the name of the file to an intermediate file name (as below, the original file name is different), and then upload procedure fails.
Below is the react part which triggers upload mechanism which works with every platform and operating system with exception of IOS.
export const UploadVideo = async (file, signedurl, uploading) =>
{
let resultState = { state: '', data: {} };
if (SERVER_STATUS !== 'localhost')
{
await axios({
method: 'put',
url: signedurl,
data: file,
headers: { 'Content-Type': 'application/octet-stream', },
onUploadProgress: uploading
}).then(function (response)
{
resultState.state = 'success';
}).catch(function (error)
{
resultState.state = 'error';
resultState.data.message = error.message;
window.toastr.error(error.message);
})
} else resultState.state = 'success';
return resultState;
}
The error message I notice here, OS Status error -9806 refers to, according to osstatus.com a secure transport result code. More specifically this one, on Apple's documentation
My take here is that the system is not trusting this URL, I would suggest adding your URL to trusted domains under NSAppTransportSecurity in the Info.plist file. More info on how to do that here.
This is not a solution I would go for for a production app tho, you might want to have a valid certificate for your production URL and app.
Hope this helps.
I'm working in a React web app project that's using Firebase Google sign in. The sign in apparently stopped working on iOS mobile devices after an update to iOS 16 or higher. The issue is the same in both Safari and Chrome browsers. It still works fine on other devices though. It seems that the page gets reloaded after I have selected my Google account from the list. I've tried inspecting the network tab but I'm not getting any errors.
We're using Firebase version 7.6.2 and I tried updating to the latest, which is 9.15.0 but the problem persists. We also have email + password login and that works just fine on all devices.
Here's the Firebase part of our current code if that helps:
import * as firebase from 'firebase/app'
import 'firebase/auth'
import * as firebaseui from 'firebaseui'
import { apiGET, api } from './api'
const initFirebase = apiGET('/firebase-config-url')
.then((config) => firebase.initializeApp(config))
.then(() => firebase.auth())
export const firebaseAuth = initFirebase
export const signInOptions = {
signInSuccessUrl: '/',
signInOptions: [
{
provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID,
customParameters: {
prompt: 'select_account',
},
},
firebase.auth.EmailAuthProvider.PROVIDER_ID,
],
}
export const bindUI = (el, options = signInOptions) => {
firebaseAuth.then((auth) => {
const ui = new firebaseui.auth.AuthUI(auth)
ui.start(el, { ...signInOptions, ...options })
})
}
Has anyone else experienced similar issues on newer iOS versions and is there a solution for fixing this?
The PouchDB data is getting remove after my Cordova base app is "hard" close .
Here are the steps :
Install the app
save some data in PouchDB name test
verify that the data is saved
close the app (on iOS double click the hone button)
reopen the app
Verify that saved lost
This only happen on the first install
As a test I created two button on a form with a sample code
$scope.saveme=function(){
var db =new PouchDB("test");
var todo = {
_id: new Date().toISOString(),
title: "test",
completed: false
};
db.put(todo, function callback(err, result) {
if (!err) {
alert('Successfully posted a todo!');
}
else{
alert(err);
}
});
}
$scope.showme = function(){
var db =new PouchDB("test");
db.allDocs({include_docs: true, descending: true}, function(err, doc)
{
alert(JSON.stringify(doc));
});
}
ios version: 4.5.4
cordova :6.5
pouch : 6.4.1
Can you please let me know how to resolve this issue
Sometimes IOS delete localstorage for his internal cleaning policy, this issue also may be happend in Android 6+ platforms.
Try to use this plugin, to persist localstorage info in sharedPreferences on IOS platform.
Cordova persist localStorage
Git Repository
I am working on ionic meteor using the in-app purchase plugin "cordova-plugin-inapppurchase" (https://github.com/AlexDisler/cordova-plugin-inapppurchase).
When I request 'inAppPurchase.buy(productId)' , I get an error "Object {message: "Billing is not initialized", code: -3, errorCode: -3}"
My code is :
inAppPurchase
.buy('com.myapp.prod1')
.then(function (data) {
console.log(data);
})
.catch(function (err) {
console.log(err);
});
Ionic Information
For ios, it is pretty straight forward, but for android, you need to go to Google playstore, development tool, services and api then copy the base 64 licensing key.
Create a file called manifest.json in the src directory of your ionic project then add the key inside the file in the format below.
{ "play_store_key": "<Base64-encoded public key from the Google Play Store>" }
Add the file to the www folder of the ionic project by adding the path to the angular.json file found in the root folder of the project as shown below.
Sample of angular.json file
call getproducts method before buy or subscribe to initialize the store.
inAppPurchase
.getProducts([
'product.id'
])
.then(function (products) {
$log.debug(products);
})
.catch(function (err) {
$log.error(err);
});
Follow the rest of the instructions here (https://github.com/AlexDisler/cordova-plugin-inapppurchase) and It should work perfectly. Thank you.
got the same error but, I can see that it helps to do:
inAppPurchase
.getProducts([
'product.id'
])
.then(function (products) {
$log.debug(products);
})
.catch(function (err) {
$log.error(err);
});
even through you are fetching your products from, say dbs.
The error (Billing is not initialized) message disappeared after I called the "restore purchases" first.
I now can see the Google Play "BUY" popup screen.
I'm trying to use Notification Hub to push Cordova app(iOS)
Azure side is as below.
Source code on client side is as below.
I'm sure Azure client is correctly connected and registration is successful.
function initPushNotification(){
var push = PushNotification.init({
android: {
senderID: "12345679"
},
ios: {
alert: "true",
badge: "true",
sound: "true"
},
windows: {}
});
var registrationSuccess = function () {
alert('Registered with Azure!');
};
var registrationFailure = function (error) {
alert('Failed registering with Azure: ' + error);
};
push.on('registration', function(data) {
client.push.apns.registerTemplate(handle,
'myTemplate', template, null)
.done(registrationSuccess, registrationFailure);
});
push.on('notification', function(data) {
alert('Push Received: ' + data.message);
});
push.on('error', function(e) {
alert(e.message);
});
But when I execute Test Send from notification hub page, nothing happens.
I tried from simple ruby script to APNS directly and notification comes to iPhone correctly.
Does anyone know how to fix it or any information?
My environment is
MacBook Pro
OS X ElCapitan
Cordova 6.0.0
com.microsoft.azure-mobile-services 1.2.9 "Windows Azure Mobile Services"
phonegap-plugin-push 1.6.2 "PushPlugin"
Most likely the call to client.push.register() is not succeeding for some reason. I'm not using the particular plugin you're using, I'm using azure-mobile-apps-cordova-client combined with phonegap-plugin-push. So far, this combination is working for my purposes.
You can find a more complete example here: Add Push Notifications to your Apache Cordova App.
One thing I would add is that when you call the push.register() API in the azure-mobile-apps-cordova-client plugin, you can give it an error function callback that gets called if the API call fails. It would look like this:
push.register('apns', data.registrationId, null, null, function(err)
{console.log(err);});
Lastly, in Visual Studio, you can also connect to your notification hub and list and manage the registrations. This is useful to determine if the APNS registration is really accepted.