iOS SDK集成指南

1.SDK文件结构说明

  • CydoniaSDK.framework :SDK核心文件

  • GoogleService-Info.plist :Firebase使用的配置文件

2.集成步骤

2.1 获取SDK

  1. 从PM那里获取SDK或者下载

  2. 解压缩

2.2 进入Xcode工程文件夹

1) 打开Terminal进入项目目录下执行pod init。如果没有安装pod,请参照https://cocoapods.org/

2) 修改Podfile文件,参照Demo添加

# Uncomment the next line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'CydoniaIOSDemo' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for CydoniaIOSDemo
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  pod 'Adjust', '~> 4.18.3'
  pod 'TwitterKit', '~> 3.4.2'

end

3) 继续在终端执行pod install.

4) 打开新生成的**.xcworkspace

5) 将GoogleService-Info.plist拖到项目工程,勾选Copy if needed,可参照如下截图

6)同样方式将CydoniaSDK.framework加入到工程

7)修改Xcode工程Building Settings,将Allow Non-modular includes In Framework Modules设置为YES,将Enable Bitcode设置为No

8)修改Xcode工程的Capabilities,打开Background Modes的remote notification,In-App Purchases,Keychain Sharing, Push Notifications,Sign in with Apple(iOS13+)

9)修改工程的Info.plist,添加如下内容,其中具体TwitterID需要进行替换

<key>CFBundleURLTypes</key>
	<array>
	<!--如果开启了Twitter-->
		<dict>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>twitterkit-oAVK24FdUE0NCPcEoClyVXvb3</string>
			</array>
		</dict>
	</array>
	<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>twitter</string>
		<string>twitterauth</string>
	</array>
	
	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>
	

iOS13.0开始提供Sign in with Apple,需要使用Xcode11。在Signing&Capabilities增加Capability,然后选择Sign in with Apple.

10)根据Demo修改文件AppDelegate.h,AppDelegate.m。

其中一些配置参数可能还没有生成,可以使用临时的,与技术随时联系获取。

11)参考ViewController.m来使用SDK

3.常见问题

1.真机运行时出现no suitable image found.错误

此时,设定Xcode->Build Settings->Embed Asset Packs In Product Bundle Yes

Last updated

Was this helpful?