ios - MWPhotoBrowser 使用 Swift 导入错误

标签 ios swift mwphotobrowser

我一直在快速构建一个应用程序以使用 github 上的 MWPhotoBrowser 库,但我在 Xcode 中有很多错误,这正是我所做的:

1- 创建了一个 swift 项目。

2- 将二进制文件与库链接

2.1- UIKit、Foundation、AssetsLibrary、MediaPlayer、QuartzCore、CoreGrahpics、ImageIO。

3- 我手动导入了以下库:

3.1- SDWebImage、MWPhotoBrowser、MBProgressHUD、DACircularProgress。

这应该足以满足 MWPhotoBrowser 工作的先决条件。 还没有添加桥接头,我有 27 个错误。

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.

我在github上上传了我的项目:https://github.com/AaoIi/PhotoBrowser_2

最佳答案

如果你已经添加了所有需要的框架那么你只需要基本上添加

#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>

到您的 MWPhotoBrowser 文件夹中的所有 .h 文件

至于其他框架,如果你手动导入它们,那么你需要改变

#import <DACircularProgressView/DACircularProgressView.h>

#import "DACircularProgressView.h"

在调用的 m 个文件中,对调用的 MBProgressHUD、DACircularProgress 和 SDWebImage 文件执行此操作

关于ios - MWPhotoBrowser 使用 Swift 导入错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32035510/

相关文章:

android - 移动应用程序 UI 开发和集成过程

swift - NSTableView socket 在代码中子类化为 NSOutlineView?

ios - Swift 中的 Objective-C 协议(protocol) - 显示不符合错误

ios - 如何更改 TabBarItem 的背景颜色

ios - "CoreData: error: NULL _cd_rawData but the object is not being turned into a fault"

ios - Libgdx IOS 不工作?

ios - 将文本段落(包括换行符)存储在云包中并查询

swift - 图像分类器在 Xcode 中的分类标签中不显示结果

iphone - 如何将 MWPhotoBrowser 与我现有的 StoryBoard 集成

ios - 无法在图像之间滚动