我有一个单视图应用程序设置与CocoaPods,只包括两个pod,' MBProgressHUB'和' ImojiSDK'。
当CocoaPods设置为静态库时,项目构建并正常运行。当我将CocoaPods配置为使用框架时,通过包含' use_frameworks!'在Podfile中标记,项目构建,但运行时崩溃。
问题是,为什么它作为静态库运行良好,但在使用框架时却没有?
当我尝试在视图的viewDidLoad中创建一个新的ImojiSDK会话时发生崩溃:
IMImojiSession *session = [IMImojiSession imojiSession]; //THIS IS WHERE IT CRASHES
session.contentCache = [[NSCache alloc] init];
session.contentCache.countLimit = 100;
以下是Xcode的Podfile和崩溃输出:
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
use_frameworks!
pod 'MBProgressHUD'
pod 'ImojiSDK'
2015-07-20 14:05:18.031 imoji[19887:323843] +[BFTask im_concurrentBackgroundTaskWithBlock:]: unrecognized selector sent to class 0x1041b6878
2015-07-20 14:05:18.035 imoji[19887:323843] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[BFTask im_concurrentBackgroundTaskWithBlock:]: unrecognized selector sent to class 0x1041b6878'
*** First throw call stack:
(
0 CoreFoundation 0x0000000104aafc65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104746bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000104ab6fad +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000104a0d13c ___forwarding___ + 988
4 CoreFoundation 0x0000000104a0ccd8 _CF_forwarding_prep_0 + 120
5 imoji 0x0000000104003962 -[IMMutableImojiSessionStoragePolicy performCleanupOnOldImages] + 93
6 imoji 0x0000000104002c4f -[IMMutableImojiSessionStoragePolicy initWithCachePath:persistentPath:] + 175
7 imoji 0x000000010400ec6d +[IMImojiSessionStoragePolicy temporaryDiskStoragePolicy] + 210
8 imoji 0x0000000104003dfc -[IMImojiSession init] + 76
9 imoji 0x000000010400e8c7 +[IMImojiSession imojiSession] + 41
10 imoji 0x0000000103fd6b8c -[ViewController viewDidLoad] + 76
11 UIKit 0x000000010526d1d0 -[UIViewController loadViewIfRequired] + 738
12 UIKit 0x000000010526d3ce -[UIViewController view] + 27
13 UIKit 0x0000000105188289 -[UIWindow addRootViewControllerViewIfPossible] + 58
14 UIKit 0x000000010518864f -[UIWindow _setHidden:forced:] + 247
15 UIKit 0x0000000105194de1 -[UIWindow makeKeyAndVisible] + 42
16 UIKit 0x0000000105138417 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
17 UIKit 0x000000010513b19e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
18 UIKit 0x000000010513a095 -[UIApplication workspaceDidEndTransaction:] + 179
19 FrontBoardServices 0x00000001085585e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
20 CoreFoundation 0x00000001049e341c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
21 CoreFoundation 0x00000001049d9165 __CFRunLoopDoBlocks + 341
22 CoreFoundation 0x00000001049d8f25 __CFRunLoopRun + 2389
23 CoreFoundation 0x00000001049d8366 CFRunLoopRunSpecific + 470
24 UIKit 0x0000000105139b02 -[UIApplication _run] + 413
25 UIKit 0x000000010513c8c0 UIApplicationMain + 1282
26 imoji 0x0000000103fd6fef main + 111
27 libdyld.dylib 0x0000000106579145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
答案 0 :(得分:2)
use_frameworks!
通过在新的动态框架中构建代码来支持Swift支持。动态框架仅支持iOS 8
答案 1 :(得分:0)
ImojiSDK pod最近更新了框架兼容性。 https://github.com/imojiengineering/imoji-ios-sdk