aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.68k stars 884 forks source link

Using aws-amplify/aws-sdk-ios in app and also custom SDK used by that app. #2784

Closed deepesh-vasthimal-cko closed 4 years ago

deepesh-vasthimal-cko commented 4 years ago

State your question Can I use aws-amplify/aws-sdk-ios SDK in my app and also inside custom SDK which i have written. meaning there are 2 instances of aws-amplify/aws-sdk-ios running one in app and one in my custom SDK. Will this not cause a clash ?

[app] ---uses---> aws-amplify/aws-sdk-ios SDK [app] ---uses---> my custom SDK [my custom SDK] ---uses---> aws-amplify/aws-sdk-ios SDK

Which AWS Services are you utilizing? aws-amplify/aws-sdk-ios

Provide code snippets (if applicable) N/A

Environment(please complete the following information): NA

Device Information (please complete the following information): NA

If you need help with understanding how to implement something in particular then we suggest that you first look into our developer guide. You can also simplify your process of creating an application, as well as the associated backend setup by using the Amplify CLI.

palpatim commented 4 years ago

Generally, iOS projects resolve dependencies to a single binary. If you have custom frameworks that depend on the AWS SDK for iOS, it's best to have each of them rely on the SDK, but not package it directly with the framework. The host app would be responsible for importing a single binary version that all of the app dependencies would use.

Do note that the SDK expects to be configured once, and shares that configuration with all use cases. It's certainly possible to configure and run multiple AWS services from the SDK (e.g., using AWSMobileClient for auth, Pinpoint for analytics, and Lex for interactions, for example).

Hope this helps.

deepesh-vasthimal-cko commented 4 years ago

Thanks @palpatim , But I have one more clarification, if you can please help me answer below would be great

So if I configure my AWS services instance to run with a username1 which is responsible for example using one of the AWS services in my custom SDK. Then if my host app also uses AWS services the host app may have a different username for example username2 ( and every host app could have a different username itself ) ? how do you think will that work ? Meaning will that not be a clash ?

palpatim commented 4 years ago

If I understand your description, the configuration you describe will not work: the SDK expects to be run with at most one user at a time. Depending on your configuration, this might be a "guest" or "unauthenticated" user, or a user that has been authenticated via one of the various supported authN mechanisms.

I encourage you to look closely at your use cases and see if you really need two different client-side users. You might be able to accomplish your desired outcomes by, for example, triggering Lambda functions from various service calls, which emit notifications to SNS topics that other services subscribe to and use to process their notifications. Not knowing anything about your use case, I have to say I'm hard pressed to think of a time when I'd want a totally separate client-side authentication context running alongside my user's auth context.

bimal-geospark commented 4 years ago

Generally, iOS projects resolve dependencies to a single binary. If you have custom frameworks that depend on the AWS SDK for iOS, it's best to have each of them rely on the SDK, but not package it directly with the framework. The host app would be responsible for importing a single binary version that all of the app dependencies would use.

Do note that the SDK expects to be configured once, and shares that configuration with all use cases. It's certainly possible to configure and run multiple AWS services from the SDK (e.g., using AWSMobileClient for auth, Pinpoint for analytics, and Lex for interactions, for example).

Hope this helps.

Generally, iOS projects resolve dependencies to a single binary. If you have custom frameworks that depend on the AWS SDK for iOS, it's best to have each of them rely on the SDK, but not package it directly with the framework. The host app would be responsible for importing a single binary version that all of the app dependencies would use.

Do note that the SDK expects to be configured once, and shares that configuration with all use cases. It's certainly possible to configure and run multiple AWS services from the SDK (e.g., using AWSMobileClient for auth, Pinpoint for analytics, and Lex for interactions, for example).

Hope this helps.

This is exactly what I am doing to achive a connection from SDK to AWSIOT, but createKeysAndCertificate function returns always nil , so unable to create key ans certificate, and do further action.

royjit commented 4 years ago

@bimal-geospark Your issue seems to be specific to AWSIoT, could you please create a new issue here and provide us more details to debug the issue,

stale[bot] commented 4 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.