我创建一个新的可可触摸框架(MyFramework.framework),这将对Alamofire的依赖.这个框架将用Swift编写.作为测试,我开始了一个新的Cocoa Touch Framework项目:
File > New > Project > Framework & Library > Cocoa Touch Framework
Run Code Online (Sandbox Code Playgroud)
然后,在我执行的终端中:
pod init
Run Code Online (Sandbox Code Playgroud)
在这个项目目录下.在新创建的Podfile中,我添加了以下内容:
source 'https://github.com/CocoaPods/Specs.git'
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
pod 'Alamofire', '~> 3.0'
Run Code Online (Sandbox Code Playgroud)
再次,在终端我执行:
pod install
Run Code Online (Sandbox Code Playgroud)
并开始编码.
在单视图项目中使用MyFramework.framework产品之前,一切似乎都很好.当我尝试运行该项目时,我遇到以下问题:
dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire
Referenced from: /Users/me/Library/Developer/CoreSimulator/Devices/87DA70B6-49BF-441E-BD81-F4A80B0792CF/data/Containers/Bundle/Application/2E414EA8-7E54-4D71-9295-566D4FAAADE2/test.app/Frameworks/MyFramework.framework/MyFramework
Reason: image not found
Run Code Online (Sandbox Code Playgroud)
我认为Cocoa Touch Framework项目本身就是动态的,因此会包含所有依赖项.
任何人都可以告诉我为什么会发生这种情况以及我如何能够解决这个问题?这是CocoaPods的问题还是我错过了什么?
我是Stack Overflow的菜鸟,所以如果您需要我提供更多信息,请告诉我.
谢谢!
我有一个应用程序当前使用名为 MyFramework 的自定义 Cocoa Touch 框架。在其中,我依赖于 Core Data,我用它来缓存 SQLite 存储中的数据。
在测试过程中,一切都按预期工作,但现在我已经将应用程序共享给越来越多的用户,我收到以下致命异常:
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x1848651b8 __exceptionPreprocess
1 libobjc.A.dylib 0x18329c55c objc_exception_throw
2 CoreData 0x186c49260 -[NSPersistentStoreCoordinator _coordinator_you_never_successfully_opened_the_database_corrupted:]
3 CoreData 0x186c494b8 -[NSPersistentStoreCoordinator _introspectLastErrorAndThrow]
4 CoreData 0x186c49840 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke
5 CoreData 0x186c42bf0 -[NSPersistentStoreCoordinator _routeHeavyweightBlock:]
6 CoreData 0x186b67f20 -[NSPersistentStoreCoordinator executeRequest:withContext:error:]
7 CoreData 0x186b67f4c -[NSPersistentStoreCoordinator executeRequest:withContext:error:]
8 CoreData 0x186b895ac -[NSManagedObjectContext save:]
9 MyFramework 0x1016608a4 (Missing)
10 CoreData 0x186c0de98 developerSubmittedBlockToNSManagedObjectContextPerform
11 libdispatch.dylib 0x1836ee1bc _dispatch_client_callout
12 libdispatch.dylib 0x1836fc3dc _dispatch_queue_serial_drain
13 libdispatch.dylib 0x1836f19a4 _dispatch_queue_invoke
14 libdispatch.dylib 0x1836fe34c …Run Code Online (Sandbox Code Playgroud)