找不到“ iTunesLibrary / ITLibDefines.h”文件

时间:2018-12-11 11:17:27

标签: swift xcode macos itunes macos-mojave

我有一个Swift项目,可以在macOS上与iTunes对话。该项目在具有XCode 9的macOS 10.13下完美构建,但是自从更新到10.14和XCode 10编译以来,失败并显示以下消息:

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/iTunesLibrary.h"
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/iTunesLibrary.framework/Headers/iTunesLibrary.h:12:9: error: 'iTunesLibrary/ITLibDefines.h' file not found
#import <iTunesLibrary/ITLibDefines.h>
        ^
/MY_PROJECT_PATH/ITunesLibrary.swift:10:8: error: could not build Objective-C module 'iTunesLibrary'
import iTunesLibrary
       ^

我已经签入/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/iTunesLibrary.framework/Headers,文件iTunesLibrary.hITLibDefines.h存在。 iTunesLibrary.h的内容是:

/*!
    @header     iTunesLibrary.h

    @copyright  (c) 2012-2014 Apple Inc. All rights reserved.
*/

#ifndef ITUNESLIBRARY_H
#define ITUNESLIBRARY_H

#import <Foundation/Foundation.h>

#import <iTunesLibrary/ITLibDefines.h>
#import <iTunesLibrary/ITLibAlbum.h>
#import <iTunesLibrary/ITLibArtist.h>
#import <iTunesLibrary/ITLibArtwork.h>
#import <iTunesLibrary/ITLibMediaEntity.h>
#import <iTunesLibrary/ITLibMediaItem.h>
#import <iTunesLibrary/ITLibMediaItemVideoInfo.h>
#import <iTunesLibrary/ITLibPlaylist.h>
#import <iTunesLibrary/ITLibrary.h>

#endif  /* ITUNESLIBRARY_H */

由于编译器找到了iTunesLibrary.h,我很困惑,为什么找不到<iTunesLibrary/ITLibDefines.h>

有什么想法吗?一些搜索路径?

谢谢。

2 个答案:

答案 0 :(得分:0)

找出框架搜索路径(在Project-> Target-> Build Settings下)确实是罪魁祸首。删除我的自定义替代可以解决此问题。有趣的是,如果我没记错的话,我已经添加了它们,因为Xcode找不到我的框架...

另请参阅https://forums.developer.apple.com/message/328635#328779

答案 1 :(得分:0)

将“始终搜索用户路径”设置为“否”将解决问题