Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Carthage support #37

Closed
mdescalzo opened this issue Oct 24, 2019 · 19 comments
Closed

Add Carthage support #37

mdescalzo opened this issue Oct 24, 2019 · 19 comments

Comments

@mdescalzo
Copy link

I have some projects already using Carthage in which I'd like to use the Giphy framework. Could you please look into adding Carthage support?

@cgmaier
Copy link
Contributor

cgmaier commented Oct 28, 2019

hey thanks for reaching out ! i noted this request to my team - hopefully we can get to this at some point

@Drusy
Copy link

Drusy commented Oct 31, 2019

Carthage support would be great !
In the meanwhile, do you provide the compiled frameworks outside of Cocoapods ?
We do not wish to include Cocoapods for a single framework unfortunately

@cgmaier
Copy link
Contributor

cgmaier commented Oct 31, 2019

hey @Drusy, @mdescalzo and anyone else !

please email [email protected] with the name of your app and your requests - this could help loop in our SDK partnerships team about the importance of having another method of integrating the SDK (alternative to cocoapods) so we can better prioritize it. they also always like to be connected with teams & apps who want to use GIPHY : )

i of course to hope to get to this regardless but can't promise anything

@Drusy - i don't think there's any problem in sharing these with you (this is what pod 'Giphy' pulls in), however, i'm concerned you may have trouble linking the SDK's dependencies. I have not tested this so you're on your own unfortunately. definitely let me know how it goes please !

https://s3.amazonaws.com/sdk.mobile.giphy.com/SDK/1.1.4/GiphySDK.zip
https://s3.amazonaws.com/sdk.mobile.giphy.com/SDK/1.1.4/Giphy.podspec
^ the podspec for clarifying dependencies

@Drusy
Copy link

Drusy commented Nov 4, 2019

Hey @cgmaier,

Thanks for the links, it will help us for now. We can pull DeepDiff and PINCache from Carthage as they are fully compatible. libwebp is a bit more complicated for now and we need to script the framework compilation.
Some library are compatible with Carthage but seem to include libwebp as a submodule and compile it right in the project I guess. Here is an example https://github.com/ainame/Swift-WebP

I will definitely contact you on [email protected] if it may help to prioritize. Unfortunately for now, I don't see us using this SDK seriously if it forces us to use Cocoapods. It's too much energy for updating a single dependency.

@cgmaier
Copy link
Contributor

cgmaier commented Nov 5, 2019

Thanks @Drusy !

@mdescalzo
Copy link
Author

@cgmaier Thanks! I'll look at the links when that facet of the project circles back to it. There's no linkable app just yet. We're still in development.

@ammerzon
Copy link

I also gave the SDK a try with Carthage. I added all the required dependencies to my Cartfile and downloaded the Giphy framework as you can see below. For libwebp I used a wrapper from SDWebImage.

Cartfile.resolved

github "onmyway133/DeepDiff" "2.3.1"
github "pinterest/PINCache" "2.3"
github "SDWebImage/libwebp-Xcode" "1.0.3"

GiphySDK 1.1.5

Carthage build phase
Screenshot 2019-12-13 at 11 05 01

Screenshot 2019-12-13 at 11 06 14

Unfortunately I am now getting the following errors:
Screenshot 2019-12-13 at 11 08 58

Does anyone know how to get the undefined symbols?

@cgmaier
Copy link
Contributor

cgmaier commented Dec 16, 2019

hey @ammerzon - we're looking at officially supporting carthage in the coming year

in the mean time, i think you might try adding an additional entry in input files:

...iOS/GiphyCoreSDK.framework/omsdk-ios-1.2.20-Giphy/OMSDK_Giphy.framework

and in output files:
...$(FRAMEWORKS_FOLDER_PATH)/OMSDK_Giphy.framework

have no idea if this will work, but worth a try. let me know either way !

@ammerzon
Copy link

That is great to hear 🎉

Screenshot 2019-12-16 at 18 35 42

Unfortunately, it now complains that the bundle format is unrecognized, invalid, or unsuitable.

@cgmaier
Copy link
Contributor

cgmaier commented Dec 16, 2019

could you try ...GiphyCoreSDK.framework/Frameworks/OMSDK_Giphy.framework instead? in input files

@ammerzon
Copy link

ammerzon commented Dec 16, 2019

I tried that but it leads to the same result as above.

Also worth mentioning. I do not embed the framework.
Screenshot 2019-12-16 at 21 23 41

@cgmaier
Copy link
Contributor

cgmaier commented Dec 16, 2019

hmm maybe a framework search paths thing (in build settings?)

sorry i can't be of more help here

@cgmaier
Copy link
Contributor

cgmaier commented Jan 22, 2020

hey all ! sorry for the delay on this. think I've got distribution / installation through Carthage working. we'll hopefully "officially" release / document Carthage support soon but wanted to give you a chance to test it out first:

Carthage Setup

  1. Add GiphySDK to your Cartfile:
binary "https://s3.amazonaws.com/sdk.mobile.giphy.com/SDK/GiphySDK.json"
  1. Add -ObjC to the Other Linker Flags Build Setting

  2. Add PINCache.framework, DeepDiff.framework, GiphyCoreSDK.framework, GiphyUISDK.framework, WebP.framework, and OMSDK_Giphy.framework from Carthage/Build/iOS into your project. (OMSDK_Giphy.framework can be found inside of the GiphyCoreSDK.framework)

  3. Create a new Run Script under Build Phases (See step 8 of the directions here). Only 2 of the frameworks need to be added to the run script (The rest can be excluded from this step as they are static frameworks):

  • PINCache.framework
  • DeepDiff.framework

cc @ammerzon @Drusy @mdescalzo

@Drusy
Copy link

Drusy commented Jan 24, 2020

Hey @cgmaier, thanks for your efforts.

The project compiles well with this integration. However, I can't make the UI framework work properly.
When I try to show a GiphyViewController(), I have the following error

2020-01-24 10:14:26.587820+0100 giphy-carthage[62050:2078034] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GiphyUISDK.GiphySearchController registerKeyboardNotifications]: unrecognized selector sent to instance 0x7ffe48424740'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
	1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   UIKitCore                           0x00007fff480c0f17 -[UIResponder doesNotRecognizeSelector:] + 302
	4   CoreFoundation                      0x00007fff23c75c4c ___forwarding___ + 1436
	5   CoreFoundation                      0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
	6   giphy-carthage                      0x000000010daeae90 $s10GiphyUISDK0A16SearchControllerC13noResultsViewAA05GPHNoF0CvgTo + 160
	7   UIKitCore                           0x00007fff47a19d47 -[UIViewController _setViewAppearState:isAnimating:] + 663
	8   UIKitCore                           0x00007fff47a1a479 -[UIViewController __viewWillAppear:] + 115
	9   UIKitCore                           0x00007fff47978726 -[UINavigationController _startTransition:fromViewController:toViewController:] + 718
	10  UIKitCore                           0x00007fff479793b6 -[UINavigationController _startDeferredTransitionIfNeeded:] + 868
	11  UIKitCore                           0x00007fff4797a721 -[UINavigationController __viewWillLayoutSubviews] + 150
	12  UIKitCore                           0x00007fff4795b553 -[UILayoutContainerView layoutSubviews] + 217
	13  UIKit                               0x000000010ff4dae1 -[UILayoutContainerViewAccessibility layoutSubviews] + 42
	14  UIKitCore                           0x00007fff485784bd -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478
	15  QuartzCore                          0x00007fff2b131db1 -[CALayer layoutSublayers] + 255
	16  QuartzCore                          0x00007fff2b137fa3 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 517
	17  UIKitCore                           0x00007fff48563635 -[UIView(Hierarchy) layoutBelowIfNeeded] + 980
	18  giphy-carthage                      0x000000010dacead5 $s10GiphyUISDK0A14ViewControllerC17animateTransition5usingySo06UIViewD20ContextTransitioning_p_tF + 725
	19  giphy-carthage                      0x000000010dacef49 $sSo23UIViewAnimatingPositionVIegy_ABIeyBy_TR + 105
	20  UIKitCore                           0x00007fff47a42cf5 ___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 54
	21  UIKitCore                           0x00007fff47b5af7e +[UIInputResponderController _pinInputViewsForInputResponderController:onBehalfOfResponder:duringBlock:] + 99
	22  UIKitCore                           0x00007fff47a42c89 ___UIViewControllerTransitioningRunCustomTransition_block_invoke.645 + 180
	23  UIKitCore                           0x00007fff4856a351 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] + 175
	24  UIKitCore                           0x00007fff47a42b0f _UIViewControllerTransitioningRunCustomTransition + 553
	25  UIKitCore                           0x00007fff47924740 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.465 + 2632
	26  UIKitCore                           0x00007fff4809be5b _runAfterCACommitDeferredBlocks + 352
	27  UIKitCore                           0x00007fff4808c7b4 _cleanUpAfterCAFlushAndRunDeferredBlocks + 248
	28  UIKitCore                           0x00007fff480bc3a9 _afterCACommitHandler + 85
	29  CoreFoundation                      0x00007fff23bd3867 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
	30  CoreFoundation                      0x00007fff23bce2fe __CFRunLoopDoObservers + 430
	31  CoreFoundation                      0x00007fff23bce97a __CFRunLoopRun + 1514
	32  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
	33  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
	34  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
	35  giphy-carthage                      0x000000010da4b79b main + 75
	36  libdyld.dylib                       0x00007fff5227ec25 start + 1
	37  ???                                 0x0000000000000001 0x0 + 1

I also tried to add a GPHMediaView to my view. I can easily get a media using GiphyCore.shared.gifByID but nothing is showing and I have no error log and error is nil in the callback

GiphyCore.shared.gifByID("7bWtoBmjn6fAI") { (response, error) in
    if let media = response?.data {
        DispatchQueue.main.sync { [weak self] in
            self?.giphyView.media = media
        }
    }
}

@cgmaier
Copy link
Contributor

cgmaier commented Jan 24, 2020

Hey @Drusy thanks so much for giving this a shot! My apologies - it looks like I wrote -Objc rather than -ObjC for the build setting. Adding -ObjC to Other Linker Flags should fix the crash you note. I'll work on making it not necessary to set this build setting in the future.

I'll look into the GPHMediaView issue and get back to you.

@Drusy
Copy link

Drusy commented Jan 24, 2020

Sorry, I should have used the correct flag indeed ... The controller works like a charm. The GPHMediaView still appears to be broken.

@cgmaier
Copy link
Contributor

cgmaier commented Jan 24, 2020

thanks for confirming ! it was my bad actually - i initially wrote the flag incorrectly.

re GPHMediaView, good catch - there's another issue with our documentation. simply setting the media property on the view doesn't do anything. you must explicitly call setMedia. sorry about that! we'll definitely fix this and make that property only as a get

@Drusy
Copy link

Drusy commented Jan 24, 2020

It works using setMedia

we'll definitely fix this and make that property only as a get

Definitely sounds like a good idea !

Congratulations, you seem to officially support Carthage !
The last step would be to submit a Testflight build to ensure that the archive process is fine.

Thanks for this feature 👏

@cgmaier
Copy link
Contributor

cgmaier commented Jan 24, 2020

another good call @Drusy !

per your suggestion of testing archive / distribution, I noticed another issue - only two of the frameworks (PINCache and DeepDiff) should be included in the run script step, as the rest are static frameworks. I updated my previous comment which had the carthage setup instructions.

thanks for your help!

@cgmaier cgmaier closed this as completed Mar 19, 2020
djrluna pushed a commit that referenced this issue Apr 21, 2021
Add pagination parameters to emoji endpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants