Comments (9)
Hi,
This error seems to be caused by having null in json files, could you check your awsconfiguration.json and see if there's any nulls?
from amazon-freertos-ble-ios-sdk.
This is the awsconfiguration.json. Thanks.
{
"UserAgent": "MobileHub/1.0",
"Version": "1.0",
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "us-east-2:236xxxxx-xxxx-xxxx-xxxx-47f65c34xxxx",
"Region": "us-east-2"
}
}
},
"IdentityManager": {
"Default": {}
},
"CognitoUserPool": {
"Default": {
"PoolId": "us-east-2_nfuT3xxxx",
"AppClientId": "4edgto1lril04q9j5xxxxxxx",
"AppClientSecret": "5mua76u8s3qfpdf8cjp0xxxxxxxxxxxxx",
"Region": "us-east-2"
}
}
}
I followed the instructions from the tutorial (https://docs.aws.amazon.com/freertos/latest/userguide/ble-demo.html#ble-sdk-app):
- Open amazon-freertos-ble-ios-sdk/Example/AmazonFreeRTOSDemo/AmazonFreeRTOSDemo/Support/awsconfiguration.json.
Under CognitoIdentity, redefine the following variables:
PoolId: Your Amazon Cognito identity pool ID.
Region: Your AWS Region.
Under CognitoUserPool, redefine the following variables:
PoolId: Your Amazon Cognito user pool ID.
AppClientId: Your app client ID.
AppClientSecret: Your app client secret.
Region: Your AWS Region.
from amazon-freertos-ble-ios-sdk.
That looks correct to me. I just pulled down the repo and tested with my credentials and it works correctly. If the crash happens after you enter username and password and click login, then its most likely due to
trying to attach to your iot policy, which is what you put in the AmazonConstants.swift.
Could you check if that policy is in the same region (us-east-2), the name is correct and also perform a clean build (Xcode > product > clean)
from amazon-freertos-ble-ios-sdk.
I added Thing through "python SetupAWS.py setup" (https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html). MQTT over wifi example is working.
I got IoT policy name from AWS IoT console > Manage > Things > Esp32CapBLE > Security > 8a6ea80ca3f5eef27468... > Policies > Esp32CapBLE_amazon_freertos_policy.
Here is the AmazonConstants.swift:
import AWSCore
import CoreBluetooth
import Foundation
struct AmazonConstants {
struct AWS {
// #error("Replace with your AWS Region. eg: AWSRegionType.USEast1")
static let region = AWSRegionType.USEast2
// #error("Replace with your AWS IoT Policy Name. eg: MyIoTPolicy")
static let iotPolicyName = "Esp32CapBLE_amazon_freertos_policy"
// #error("Also update FreeRTOSDemo/Support/awsconfiguration.json with your credentials.")
static let mqttCustomTopic = "freertos/demos/echo"
}
}
Thanks.
from amazon-freertos-ble-ios-sdk.
Xuan,
I am still getting the exception.
Can you please let me know if AmazonConstants.swift is ok or not. Thanks.
Here is also a screenshot from the aws iot, regarding the iot policy.
fyi if i put the iphone to airplane mode, then it does not crash and I can connect to the microcontroller through the app...
from amazon-freertos-ble-ios-sdk.
AmazonConstants looks correct. This is very strange, turning on Wifi crash is probably because it send/receive something from the server that has some issue. If you could create a private repo with your credentials and add me as collaborator, I can try it on my side.
from amazon-freertos-ble-ios-sdk.
Thanks Xuan. Here is the link with my credentials. https://github.com/noblerabbit/amazon-freertos-ble-ios-sdk-beta.
from amazon-freertos-ble-ios-sdk.
By turning on AWS Debug log
{"Message":"User: arn:aws:xxxxxxxx is not authorized to perform: iot:AttachPrincipalPolicy on resource: us-east-2:xxxxx"}
It says that the cognito role does not have the iot:AttachPrincipalPolicy permission. You could add this by go to IAM -> Roles -> your auth role -> edit policy in ison and make sure its
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Connect", "iot:Publish", "iot:Subscribe", "iot:Receive", "iot:GetThingShadow", "iot:UpdateThingShadow", "iot:DeleteThingShadow", "iot:AttachPrincipalPolicy" ], "Resource": [ "*" ] } ] }
from amazon-freertos-ble-ios-sdk.
Xuan,
I added the policy as you wrote and now the app does not crash anymore.
Thanks so much for your help. Have a great day!
from amazon-freertos-ble-ios-sdk.
Related Issues (19)
- Wi-Fi provisioning fails on ESP32 board with "Failed to allocate taskpool" error HOT 3
- Unable to access secure values after disconnecting from device HOT 7
- Return error when incorrect password is provided HOT 8
- CBOR encoding crashes when saving a network SSID with UTF characters HOT 5
- Get afrVersion spelled gatAfrVersionOfPeripheral HOT 2
- Trying to compile demo throws errors on unknown symbols for arm64 HOT 1
- XCode 13 / Swift 5.5 Support, Cut new release? HOT 2
- Replace JSON with CBOR for efficiency HOT 1
- Bluetooth is not getting connected in one go HOT 2
- AFR LTS Release HOT 16
- Published (demo) app in appstore HOT 1
- Undefined symbols for architecture arm64 HOT 10
- PIN-Based Bluetooth Connection without Default Popup HOT 4
- Make Large Object Transfer as its own service and expose in SDK HOT 1
- https://github.com/aws/amazon-freertos-ble-ios-sdk.git: No such file or directory HOT 4
- Add auto reconnect on disconnect HOT 1
- pod is throwing the error: The SWIFT_VERSION is missing for "AWSMobileClient" & "CBORSWift". HOT 5
- Can't get WiFi provisioning demo to work with ESP32 board and Release 1.5 branch of amazon-freertos HOT 24
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-freertos-ble-ios-sdk.