I use the react-native-in-app-utils (6.0.2) component in my react-native app. After upgrading a lot of components and libraries I'm unable to get the users receiptData using the InAppUtils.receiptData() function. Before upgrade this works fine.
After running
InAppUtils.receiptData((error, receiptData)=> {
if(error) {
Alert.alert('itunes Error', 'Receipt not found.');
} else {
// receiptData is undefined/empty and I'am therefore unable to verify the receipe with the users iTunes-account.
}
});
receiptData is undefined/empty and I'am therefore unable to verify the receipe with the users iTunes-account.
Before trying to get the receipt I run InAppUtils.loadProducts(..) which works fine, I get all my products.
Any suggestions?
Related
I try to upgrade an objective-c project to Swift. I'm using Azure App Service with a .NET backend to store data from my mobile app (iOS) in the cloud. I just downloaded the quickstart for Swift project from the azure portal and followed the steps in the tutorial to enable offline sync functionality. However inserting an item in the table is not working. I am using the following code to store a new item in the backend
var table : MSSyncTable?
...
self.table!.insert(item) {
(result) in
let syncItem = result.0
let error = result.1
if error != nil {
print("Error: " + error!.localizedDescription)
}
...
}
Stepping through the code at runtime revealed that error is nil so everything should be working fine, but I am not getting a new entry in my table storage.
Does anybody have experience with Azure App Service and Swift and can help me with this?
Because you are using the sync table, the actual operations to send and receive data from the server are explicit. These are represented by the pushWithCompletion:error: method on the sync context (for sending data up to the cloud), and the pullWithQuery:query:queryId:completion: method on your MSSyncTable.
Note that push automatically occurs when you pull as well.
I would expect the code to look something like:
var table : MSSyncTable?
...
self.table!.insert(item) { result in
let syncItem = result.0
let error = result.1
if error != nil {
print("Error: " + error!.localizedDescription)
}
table!.pushWithCompletion() { error in
...
}
...
}
I'm new to swift and Azure and am trying to send some data from my swift app up to my azure mobile database. I have an app with CoreData working but after fetching my data i'm running into difficulties sending it up to azure. I'm trying to use the insert table method from the azure framework.
I've tried this method:
let client = MSClient(applicationURLString: "https://mymobileapp.azure-mobile.net/", applicationKey: "aAaBbBcCc…")
var client = AppDelegate().client // To reference my constant in AppDelegate.swift
var itemTable:MSTable = client.tableWithName("Item")
var itemToInsert:NSDictionary = ["text":"My Awesome Item 1"]
itemTable.insert(itemToInsert,
completion: {
insertedItem, error in
if error{
println("error: \(error)")
}
else{
println("Success!")
}
}
)
But I'm running into problems with the application key. From what I can gather, the application keys are no longer used in Azure Mobile Apps.
I've also tried the method shown in the Mobile App QuickStart guide for swift but the code seems to be for an older version of swift.
I'm not trying to display a table in my app just upload data to the database. Any help would be appreciated!
I ended up getting it to work. The application key is no longer used in the new Azure Mobile Apps. In addition to deleting the key you have to add a new property, specifically a App Transport Security property, to allow for a connection with an unsecured HTTP site.
let client = MSClient(applicationURLString: "https://mymobileapp.azure-mobile.net/")
var client = AppDelegate().client // To reference my constant in AppDelegate.swift
var itemTable:MSTable = client.tableWithName("Item")
var itemToInsert:NSDictionary = ["text":"My Awesome Item 1"]
itemTable.insert(itemToInsert,
completion: {
insertedItem, error in
if error{
print("error: \(error)")
}
else{
print("Success!")
}
}
)
I am using Appcelerator iCloud·Cloud.Users.login·API its callback is giving me following response:
{"success":false,"error":true,"message":"JSON Parse error: Unexpected identifier \"An\""}
I am stuck on the things and not able to move forward, Our live App users on App Store are also affected from this.
Problem comes when we open Appcelerator Titanium project from Xcode and build the app from there and run on iOS simulator or device.
Here is the code which I am using:
Cloud.Users.login({
login : userId,
password : password,
}, function(e) {
//alert(e);
Ti.API.info("In success ....Cloud.Users.login..");
Ti.API.info('response from login service'+JSON.stringify(e));
if (e.success) {
Ti.API.info('User successfully login');
} else if (e.error) {
Ti.API.info(e.message);
_activityIndicator.hide();
alertWin.close();
}
//button.show();
});
In my case its going in else part because of response which I provided "success":false in the JSON which I am getting in callback function from Appcelerator cloud API.
Help me to resolve this error I am getting in callback.
I cloned a project from https://github.com/couchbaselabs/Grocery-Sync-iOS. And I have created the grocery-sync bucket in Couchbase admin. I have added several documents using iPhone simulator, and it worked becuase the documents did appear in the database. But when I try to change the title of a document, the iOS is not updating the new title of the changed document. And I tried to using the provided node.js module to change this document. Below is the node.js code for change specific document's text.
var couchbase = require("couchbase");
// Connect to Couchbase Server
var cluster = new couchbase.Cluster('127.0.0.1');
var bucket = cluster.openBucket('grocery-sync', function(err) {
if (err) {
// Failed to make a connection to the Couchbase cluster.
throw err;
}
bucket.get('-v-bZh-EUrlr0_ev-rqC8br', function(err, result) {
if (err) {
// Failed to retrieve key
throw err;
}
console.log(doc);
var doc = result.value;
// Store a document
doc.text = "Random beer from Norway";
bucket.replace('-v-bZh-EUrlr0_ev-rqC8br', doc, function(err, result) {
if (err) {
// Failed to replace key
throw err;
}
console.log(result);
// Success!
process.exit(0);
});
});
});
The node.js code did work, because I can see the changes in the database. But the iOS app is not updating any changes. the kCBLReplicationChangeNotification never gets called. I tried to rerun the simulator, the value is still the old value. So how to update changes when you change the exist document and make the iOS update it's new value? It seems the sync feature is only working one-way.
If you want changes to be replicated to Couchbase Lite instances, you have to go through the Sync Gateway. You can't directly write in the associated bucket.
So the recommended way to do this is to use Sync Gateway's REST API.
To replicate the data from the client side to the Couchbase backend server that you have, the Sync Gateway is the component that you need to have set up.
Take a look at the Sync Gateway REST API as it would allow for HTTP access to your remote Couchbase Server database.
Can also take a look at the Couchbase blog on the Sync Gateway for more in depth discussions too.
I've created an iOS application following AWS Mobile SDK examples using AWSiOSSDKv2.
I've successfully been able to connect with an unauthorized Cognito account to DynamoDB and write to the table. I log into AWS, check the table and see my records are there.
AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];
[[dynamoDBObjectMapper save:tableRow] continueWithSuccessBlock:^id(BFTask *task) {
if (!task.error) {
NSLog(#"Successfully inserted the data into the table.");
} else {
NSLog(#"Failed to insert the data into the table.");
}
return nil;
}];
However, now I want to test what will happen in a failure. I deliberately try to cause an error by changing the dynamoDBTableName to something that does not exist. Unfortunately, my code always returns success even tho it was not.
I found in another thread someone recommending putting logging to verbose which I did.
[AWSLogger defaultLogger].logLevel = AWSLogLevelVerbose;
And in the console, I do see that AWSLogger displays an error:
[{"__type":"com.amazon.coral.service#AccessDeniedException","Message":"User:
arn:aws:sts::xxxxxx:assumed-role/Cognito_xxxxxxxxUnauth_DefaultRole/iOS-Provider
is not authorized to perform: dynamodb:PutItem on resource:
arn:aws:dynamodb:us-east-1:xxxxxxxxxxxxx:table/xxxxxxxx"}]
However, In my code above, it always writes "Successfully inserted the data into the table.".
I've even tried modifying AWS Mobile Examples and can reproduce the same bug. I've also tried installing the POD and manually adding the AWSiOSSDKv2 framework to my project, neither fix the issue.
Has anyone run into this issue and does anyone know how to resolve? I'm trying to create an unauthorized user who only has write access to the dynamodb table.
Thanks
This is a known issue of the SDK, and the fix is on its way.
In the meanwhile, if you are using CocoaPods, adding the following lines to AWSDynamoDBObjectMapper.m L154 should fix it:
if (task.error) {
return task;
}