2015-07-20 65 views
0

我有一個包含CocoaPods的Single View應用程序設置,其中只包含兩個Pod,'MBProgressHUB'和'ImojiSDK'。當Podfile有'use_frameworks!'時,iOS應用程序崩潰選項

當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和崩潰:

PODFILE:

# Uncomment this line to define a global platform for your project 
# platform :ios, '6.0' 

use_frameworks! 

pod 'MBProgressHUD' 
pod 'ImojiSDK' 

CRASH OUTPUT:

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

你使用'Objective-C'或'Swift' iOS7或iOS8嗎? – Aladin

+0

我正在使用Objective-C。 –

回答

2

use_frameworks!通過在新的動態框架中構建代碼來啓用Swift支持。動態架構只支持iOS的8

CocoaPods 0.36 - Framework and Swift Support

+0

iOS部署目標設置爲8.4。 Objective-C也支持框架。 –

+0

@SpencerMüllerDiniz請問您爲什麼需要使用pod作爲框架,因爲它作爲靜態庫工作 – Aladin

+0

我在項目中有一個鍵盤擴展,ImojiSDK使用Bolts庫。 Bolts庫使用擴展中禁止的API方法。 ImojiSDK開發者建議,在這種情況下,ImojiSDK應該被用作框架。請參閱此處的疑難解答部分:https://cocoapods.org/?q=imojisdk –

相關問題