aws-amplify / aws-sdk-ios

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

Not possible to compile the iOS AWS SDK AppClip using iOS14. #2978

Closed Algalish closed 7 months ago

Algalish commented 3 years ago

Describe the bug I am trying to build the AppClip target using iOS14. But the moment I add AWS SDK pods to the target I get this problem: To Reproduce Steps to reproduce the behavior:

  1. Install 'Xcode Version 12.0 beta 6 (12A8189n)' (or any previous beta versions 1-5)
  2. Create empty iOS app
  3. Add 'AppClip target'
  4. Install '1.10.0.beta.2 version of CocoaPods' (because you can't build AppClips on a stable version of CocoaPods)
  5. Install AWS pods by using this Podfile

    
    platform :ios, '14.0'

def aws_pods

pod 'AWSCore' pod 'AWSAuthCore' pod 'AWSS3' pod 'AWSCognito' pod 'AWSCognitoIdentityProvider' pod 'AWSLambda' pod 'AWSUserPoolsSignIn'

end target 'testAppClip' do use_frameworks! aws_pods end

target 'testAppClipClip' do use_modular_headers! aws_pods end


6. Try to build the empty app 

Getting error at linking stage.

Link AWSUserPoolsSignIn (arm64)

Showing All Messages Ld /Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Products/Debug-iphoneos/AWSUserPoolsSignIn-framework/AWSUserPoolsSignIn.framework/AWSUserPoolsSignIn normal (in target 'AWSUserPoolsSignIn-framework' from project 'Pods') cd /Users/USER/Downloads/testAppClip/testAppClip/Pods /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios8.0 -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk -L/Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Products/Debug-iphoneos/AWSUserPoolsSignIn-framework -F/Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Products/Debug-iphoneos/AWSUserPoolsSignIn-framework -F/Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Products/Debug-iphoneos/AWSAuthCore-framework -F/Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Products/Debug-iphoneos/AWSCognitoIdentityProvider-framework -F/Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Products/Debug-iphoneos/AWSCognitoIdentityProviderASF-framework -F/Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Products/Debug-iphoneos/AWSCore-framework -filelist /Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/AWSUserPoolsSignIn-framework.build/Objects-normal/arm64/AWSUserPoolsSignIn.LinkFileList -install_name @rpath/AWSUserPoolsSignIn.framework/AWSUserPoolsSignIn -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/AWSUserPoolsSignIn-framework.build/Objects-normal/arm64/AWSUserPoolsSignIn_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -framework AWSAuthCore -framework AWSCognitoIdentityProvider -framework Foundation -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/AWSUserPoolsSignIn-framework.build/Objects-normal/arm64/AWSUserPoolsSignIn_dependency_info.dat -o /Users/USER/Library/Developer/Xcode/DerivedData/testAppClip-bjblqohlzvqbbnbwgiadkfzaawxf/Build/Products/Debug-iphoneos/AWSUserPoolsSignIn-framework/AWSUserPoolsSignIn.framework/AWSUserPoolsSignIn

Undefined symbols for architecture arm64: "_OBJCCLASS$_AWSTask", referenced from: objc-class-ref in AWSCognitoUserPoolsSignInProvider.o "_OBJCCLASS$_AWSDDLog", referenced from: objc-class-ref in AWSUserPoolSignUpViewController.o objc-class-ref in AWSUserPoolsUIOperations.o "_OBJCCLASS$_AWSServiceConfiguration", referenced from: objc-class-ref in AWSCognitoUserPoolsSignInProvider.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)


**Expected Behavior**
The app should build and run without problems

**Unique Configuration**
If you are reporting an issue with a unique configuration or where configuration can make a difference in code execution (i.e. Cognito) please provide your configuration. Please make sure to obfuscate sensitive information from the configuration before posting.

**Environment(please complete the following information):**
 - SDK Version: 2.15.2
 - Dependency Manager:  Cocoapods 1.10.0.beta.2
 - Swift Version : Objective-C code. (but the same works for Swift 4.0 or 5.0)
 - Xcode Version: Version 12.0 beta 6 (12A8189n)

**Device Information (please complete the following information):**
 - Device: iPhone XS Max
 - iOS Version:  iOS 14.0 beta 6
Algalish commented 3 years ago

The moment I remove the 'AWSUserPoolsSignIn' pod - the empty targets is built without problems

palpatim commented 3 years ago

Currently, the AWS SDK for iOS is only supported for iOS apps, not extensions, app clips, or widgets. I'll flag this as a feature request and we'll update this when we have more information, but I don't currently have any progress to report on this.

corey-plugshare commented 3 years ago

@palpatim Would it be possible to get some clarity on "AWS SDK for iOS is only supported for iOS apps, not extensions, app clips, or widgets?" What exactly is not supported? Is it just UI elements or is it the entirety of the authentication workflow? That is a major concern to me going forward because widgets and app clips are part of our roadmap in the very near future. At the very least I want to +1 the need for Cognito to support these.

Algalish commented 3 years ago

@corey-plugshare @palpatim I was able to make it work in the end. And unfortunately not sure what happened - after cleaning Derived Data folder and the project itself and re-installing pods - the app was built successfully. There is a however a restriction in size for AppClip for 10mb. So fitting all Amazon pods into the AppClip would be a problem. But Core+Lambda+Cognito + your own code + some of the other libs that you can use : works fine.

palpatim commented 3 years ago

Reopening this feature request to allow folks to continue to vote on it.

michaelbrewer commented 3 years ago

Now that iOS 14.3 is out this seems more appropriate than ever

Algalish commented 3 years ago

@palpatim @michaelbrewer I actually made it work and added support for Cognito and Lambda into the AppClip. S3 however was too big to add there(due to AppClip limit) so I used another way to get files from S3. And I cannot say what exactly I did after it all started working: I spent a lot of time and refactored a lot of code inside the app and disabled some things. But I can definetly say that you can use Amazon SDK with AppClip, 100%

afern247 commented 3 years ago

I don't understand how this is not available in macOS as well... We are moving towards cross-platform, when we build an app it's not only for web or mobile but for desktop as well., is there any ETA?

cosimtaiuz commented 3 years ago

I actually made it work and added support for Cognito and Lambda into the AppClip. S3 however was too big to add there(due to AppClip limit) so I used another way to get files from S3. And I cannot say what exactly I did after it all started working: I spent a lot of time and refactored a lot of code inside the app and disabled some things. But I can definetly say that you can use Amazon SDK with AppClip, 100%

@Algalish Could you explain how you got the files from S3 without including the S3 library?

alionthego commented 2 years ago

I actually made it work and added support for Cognito and Lambda into the AppClip. S3 however was too big to add there(due to AppClip limit) so I used another way to get files from S3. And I cannot say what exactly I did after it all started working: I spent a lot of time and refactored a lot of code inside the app and disabled some things. But I can definetly say that you can use Amazon SDK with AppClip, 100%

@Algalish Could you explain how you got the files from S3 without including the S3 library?

How did you make it work? I need to use Auth in extension. I notice a few people here say they made it work but without explaining how.

mevdev commented 1 year ago

Currently, the AWS SDK for iOS is only supported for iOS apps, not extensions, app clips, or widgets. I'll flag this as a feature request and we'll update this when we have more information, but I don't currently have any progress to report on this.

Is this still true?

It seems like the SDK is split up enough but each one is rather heavy for an App Clip.

Currently I'm only needing the Auth portion. It seems like that and the base 'Amplify' library take up around 4-5MB uncompressed. I've checked out the older general AWS SDK and it is smaller (~2MB). Is the older sdk still going to be supported into the future? Can I just get an unauthenticated jwt from rest calls without an sdk?

dandreiolteanu commented 8 months ago

Hello, jumping into this discussion even if the ticket is stale. Is the AWS SDK available in app extensions?

I would like to send an Analytics event from the NotificationAppExtension, basically we want to track when a notification is received on the app side.

Thanks!

atierian commented 7 months ago

The AWS SDK for iOS doesn't support app extensions. We recommend using Amplify Swift for this -- for more information, please visit https://docs.amplify.aws/swift/

Thanks!