Search code examples
iosswiftmwphotobrowser

MWPhotoBrowser import errors with Swift


Ive been building an app with swift to use MWPhotoBrowser library on github, but i have lots of errors in Xcode and this is what i did exactly:

1- Created a swift project.

2- Link binary with libraries

2.1- UIKit,Foundation,AssetsLibrary,MediaPlayer,QuartzCore,CoreGrahpics,ImageIO.

3- I've imported the following libraries manually :

3.1- SDWebImage,MWPhotoBrowser,MBProgressHUD,DACircularProgress.

That should be enough for the prerequisites of MWPhotoBrowser to work. Without yet adding the bridging header i am having 27 errors.

CompileC /Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/Objects-normal/arm64/MWTapDetectingImageView.o PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/Node-B/Desktop/PhotoBrowser2
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/Node-B/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/Node-B/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -miphoneos-version-min=8.4 -iquote /Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/PhotoBrowser2-generated-files.hmap -I/Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/PhotoBrowser2-own-target-headers.hmap -I/Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/PhotoBrowser2-all-target-headers.hmap -iquote /Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/PhotoBrowser2-project-headers.hmap -I/Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Products/Debug-iphoneos/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/DerivedSources/arm64 -I/Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/DerivedSources -F/Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Products/Debug-iphoneos -MMD -MT dependencies -MF /Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/Objects-normal/arm64/MWTapDetectingImageView.d --serialize-diagnostics /Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/Objects-normal/arm64/MWTapDetectingImageView.dia -c /Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m -o /Users/Node-B/Library/Developer/Xcode/DerivedData/PhotoBrowser2-gshddfhrhixnczafndhdvrizdbiz/Build/Intermediates/PhotoBrowser2.build/Debug-iphoneos/PhotoBrowser2.build/Objects-normal/arm64/MWTapDetectingImageView.o

In file included from /Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:9:
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.h:13:38: error: cannot find interface declaration for 'UIImageView', superclass of 'MWTapDetectingImageView'
@interface MWTapDetectingImageView : UIImageView {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.h:23:20: error: expected a type
- (void)imageView:(UIImageView *)imageView singleTapDetected:(UITouch *)touch;
                   ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.h:23:63: error: expected a type
- (void)imageView:(UIImageView *)imageView singleTapDetected:(UITouch *)touch;
                                                              ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.h:24:20: error: expected a type
- (void)imageView:(UIImageView *)imageView doubleTapDetected:(UITouch *)touch;
                   ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.h:24:63: error: expected a type
- (void)imageView:(UIImageView *)imageView doubleTapDetected:(UITouch *)touch;
                                                              ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.h:25:20: error: expected a type
- (void)imageView:(UIImageView *)imageView tripleTapDetected:(UITouch *)touch;
                   ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.h:25:63: error: expected a type
- (void)imageView:(UIImageView *)imageView tripleTapDetected:(UITouch *)touch;
                                                              ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:13:22: error: expected a type
- (id)initWithFrame:(CGRect)frame {
                     ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:20:22: error: expected a type
- (id)initWithImage:(UIImage *)image {
                     ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:27:22: error: expected a type
- (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage {
                     ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:27:56: error: expected a type
- (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage {
                                                       ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:34:50: error: expected a type
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
                                                 ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:53:26: error: expected a type
- (void)handleSingleTap:(UITouch *)touch {
                         ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:58:26: error: expected a type
- (void)handleDoubleTap:(UITouch *)touch {
                         ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:63:26: error: expected a type
- (void)handleTripleTap:(UITouch *)touch {
                         ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:14:15: error: 'MWTapDetectingImageView' cannot use 'super' because it is a root class
        if ((self = [super initWithFrame:frame])) {
                     ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:15:8: error: property 'userInteractionEnabled' not found on object of type 'MWTapDetectingImageView *'
                self.userInteractionEnabled = YES;
                     ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:21:15: error: 'MWTapDetectingImageView' cannot use 'super' because it is a root class
        if ((self = [super initWithImage:image])) {
                     ^
/Users/Node-B/Desktop/PhotoBrowser2/PhotoBrowser2/MWPhotoBrowser/Pod/Classes/MWTapDetectingImageView.m:22:8: error: property 'userInteractionEnabled' not found on object of type 'MWTapDetectingImageView *'
                self.userInteractionEnabled = YES;
                     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

I uploaded my project on github : https://github.com/AaoIi/PhotoBrowser_2


Solution

  • If you already added all the frameworks needed then you only need to basically add

    #import <Foundation/Foundation.h>
    #import <MediaPlayer/MediaPlayer.h>
    #import <QuartzCore/QuartzCore.h>
    #import <CoreGraphics/CoreGraphics.h>
    #import <AssetsLibrary/AssetsLibrary.h>
    #import <ImageIO/ImageIO.h>
    #import <UIKit/UIKit.h>
    

    to all the .h files in your MWPhotoBrowser folder

    As for the other frameworks, if you imported them manually then you need to change the

    #import <DACircularProgressView/DACircularProgressView.h>
    

    to

    #import "DACircularProgressView.h"
    

    in the m files they are called, do this for MBProgressHUD, DACircularProgress and SDWebImage files called