Как исправить 'header' Home.h 'not found' при сборке каркасного проекта с файлом modulemap - PullRequest
0 голосов
/ 16 января 2019

Я хочу создать быстрый фреймворк со смешанными файлами swift (основной) и objc (возможно, скомпилированные фреймворки). Поэтому я создал файл '...' modulemap и добавил свои пользовательские модули. В конце у меня ошибка заголовка не найдена.

Я добавил файл карты модуля в настройках сборки xcode: параметр Файл карты модуля.

Подробная ошибка:

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/user/Desktop/test/TestModule/TestModule/PublicFile.swift -emit-module-path /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/Objects-normal/x86_64/PublicFile~partial.swiftmodule -emit-module-doc-path /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/Objects-normal/x86_64/PublicFile~partial.swiftdoc -serialize-diagnostics-path /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/Objects-normal/x86_64/PublicFile.dia -emit-dependencies-path /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/Objects-normal/x86_64/PublicFile.d -emit-reference-dependencies-path /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/Objects-normal/x86_64/PublicFile.swiftdeps -target x86_64-apple-ios12.1-simulator -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk -I /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Products/Debug-iphonesimulator -F /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Products/Debug-iphonesimulator -enable-testing -g -import-underlying-module -module-cache-path /Users/user/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/TestModule-generated-files.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/TestModule-own-target-headers.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/TestModule-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/TestModule-project-headers.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/DerivedSources/x86_64 -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -ivfsoverlay -Xcc /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/user/Desktop/test/TestModule -parse-as-library -module-name TestModule -o /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/Objects-normal/x86_64/PublicFile.o -index-store-path /Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Index/DataStore -index-system-modules

CompileSwift normal x86_64 /Users/user/Desktop/test/TestModule/TestModule/PublicFile.swift (in target: TestModule)
    cd /Users/user/Desktop/test/TestModule
/Users/user/Library/Developer/Xcode/DerivedData/TestModule-aqjiakhajkrsfgdhavhwzktapigp/Build/Intermediates.noindex/TestModule.build/Debug-iphonesimulator/TestModule.build/unextended-module.modulemap:5:16: error: header 'Home.h' not found
        header "Home.h"
               ^
<unknown>:0: error: could not build Objective-C module 'TestModule'

См. Код:

TestModule.modulemap

framework module TestModule {
    umbrella header "TestModule.h"

    module Home {
        header "Home.h"
        export *
    }

    export *
    module * { export * }
}

Home.h

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface Home : NSObject

- (void)sweet;

@end

NS_ASSUME_NONNULL_END

Home.m

#import "Home.h"

@implementation Home

- (void)sweet {
    NSLog(@"Home sweet home");
}

@end

PublicFile.swift

import Foundation
import Home

//Yes only import

TestModule.h

#import <UIKit/UIKit.h>

//! Project version number for TestModule.
FOUNDATION_EXPORT double TestModuleVersionNumber;

//! Project version string for TestModule.
FOUNDATION_EXPORT const unsigned char TestModuleVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <TestModule/PublicHeader.h>

Все файлы имеют одинаковый путь уровня: папка TestModule

...