昨天发布的 objc 最新版 sdk,下载后,使用 build-framework.rb 脚本进行编译时,AVOSCloud-iOS 可以正常编译,成功生成 AVOSCloud-iOS.framework

但是在接着编译 AVOSCloudIM-iOS 的时候报错 :

In file included from leancloud-objc-sdk-cd84f34/AVOS/AVOSCloudIM/MessageCache/CacheStore/LCIMConversationCacheStore.m:13:
leancloud-objc-sdk-cd84f34/AVOS/AVOSCloudIM/AVIMConversation_Internal.h:27:19: error: unknown type
      name 'NSNotificationName'
FOUNDATION_EXPORT NSNotificationName LCIMConversationPropertyUpdateNotification;
                  ^
1 error generated.

** BUILD FAILED **


The following build commands failed:
	CompileC build/AVOS.build/Release-iphonesimulator/AVOSCloudIM-iOS.build/Objects-normal/i386/LCIMConversationCacheStore.o AVOSCloudIM/MessageCache/CacheStore/LCIMConversationCacheStore.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

>>> Command execution failed:
>>> xcodebuild     -project AVOS/AVOS.xcodeproj     -target AVOSCloudIM-iOS     -configuration Release -sdk iphonesimulator CONFIGURATION_BUILD_DIR="leancloud-objc-sdk-cd84f34/AVOS/AVOS.xcodeproj/build/.slices/AVOSCloudIM-iOS/iphonesimulator" ARCHS="i386 x86_64"

然后尝试了一下 4.2.0,用同样的方式 build-framework.rb 编译,就没有问题。

请官方确认一下,谢谢。

刚才试了一下,把两个 NSNotificationName 变量类型改成了 NSString * 编译就通过了,不知道这样会不会有问题。

改完后的 framework,在初始化的时候

self.imClient = [[AVIMClient alloc] initWithClientId:imClientID];
self.imClient.delegate = self;
[[self.imClient openWithCallback:^(BOOL succeeded, NSError *error) {
      // 失败报错
}];

会失败 报错:

The certificate for this server is invalid. You might be connecting to a server that is pretending to be “igdbgdp8.rtm.lncld.net” which could put your confidential information at risk.

求解 ......

请稍等一下,这个问题需要时间确认。

您好,我测试没有问题,具体测试步骤如下:

$ git clone "https://github.com/leancloud/objc-sdk.git" leancloud-objc-sdk
$ cd leancloud-objc-sdk
$ git submodule update --init
$ ruby build-framework.rb

感谢回复,但是我按照你的步骤尝试后,仍然有问题,具体如下:

  1. 首先完全按照你上面的 4 条命令执行后
  2. 在编译后的 leancloud-objc-sdk/AVOS/AVOS.xcodeproj/build 文件夹中,只生成了两个文件: AVOSCloud-iOS.frameworkAVOSCloud-mac.framework
    并没有 AVOSCloudIM-iOS.frameworkAVOSCloudIM-mac.framework

完整的编译日志: 完整编译.log.zip1 (36.3 KB)

. 查看日志,发现有一点报错

xcodebuild: error: SDK "appletvsimulator" cannot be located.

>>> Command execution failed:
>>> xcodebuild     -project AVOS/AVOS.xcodeproj     -target AVOSCloud-tvOS     -configuration Release -sdk appletvsimulator CONFIGURATION_BUILD_DIR="/Users/supersuraccoon/Desktop/test/leancloud-objc-sdk/AVOS/AVOS.xcodeproj/build/.slices/AVOSCloud-tvOS/appletvsimulator" ARCHS="i386 x86_64"

. 查看 build-framework.rb 脚本后,我觉得这个可能是因为 编译了

build_tvos_sdk    'AVOSCloud-tvOS'
build_watchos_sdk 'AVOSCloud-watchOS'

造成的,再者我不需要这两个平台的,所以我把这两行注释掉,再加上我也不需要 mac 的,所以也注释掉,最终就保留 iOS 平台的两个:

build_ios_sdk     'AVOSCloud-iOS'
build_ios_sdk     'AVOSCloudIM-iOS'

然后,开始重新尝试编译。

结果,还是出现了昨天的老错误:

In file included from /Users/supersuraccoon/Desktop/test/leancloud-objc-sdk/AVOS/AVOSCloudIM/MessageCache/CacheStore/LCIMConversationCacheStore.m:13:
/Users/supersuraccoon/Desktop/test/leancloud-objc-sdk/AVOS/AVOSCloudIM/AVIMConversation_Internal.h:27:19: error: 
      unknown type name 'NSNotificationName'
FOUNDATION_EXPORT NSNotificationName LCIMConversationPropertyUpdateNotification;
                  ^
1 error generated.

** BUILD FAILED **


The following build commands failed:
	CompileC build/AVOS.build/Release-iphonesimulator/AVOSCloudIM-iOS.build/Objects-normal/i386/LCIMConversationCacheStore.o AVOSCloudIM/MessageCache/CacheStore/LCIMConversationCacheStore.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

>>> Command execution failed:
>>> xcodebuild     -project AVOS/AVOS.xcodeproj     -target AVOSCloudIM-iOS     -configuration Release -sdk iphonesimulator CONFIGURATION_BUILD_DIR="/Users/supersuraccoon/Desktop/test/leancloud-objc-sdk/AVOS/AVOS.xcodeproj/build/.slices/AVOSCloudIM-iOS/iphonesimulator" ARCHS="i386 x86_64"
SuperSuRaccoontekiMacBook-Air:leancloud-objc-sdk supersuraccoon$

. 文件夹中只生成了 AVOSCloud-iOS.framework

这里是完整的编译日志: iOS单独编译.log.zip1 (30.2 KB)

麻烦官方能帮我看一下,谢谢了。

你好,请升级到 Xcode 8.3,安装最新的命令行工具。在尝试编译一下。可能是本地编译环境有点老。

改成 NSNotificationName 改成 NSString * 没有问题,只是个 alias。

下面这个报错的确是我们的问题,我们立刻修复。

The certificate for this server is invalid. You might be connecting to a server that is pretending to be “igdbgdp8.rtm.lncld.net” which could put your confidential information at risk.

以下问题已解决,请重试。

The certificate for this server is invalid. You might be connecting to a server that is pretending to be “igdbgdp8.rtm.lncld.net” which could put your confidential information at risk.