Xcode Swift error with Braintree SDK - ios

I'm trying to integrate the braintree sdk payment system into my app. I've done everything in the instructions (https://developers.braintreepayments.com/guides/drop-in/ios/v3) and I'm getting a strange error. Here's my code:
#IBAction func purchase(sender: AnyObject) {
let dropInViewController: BTDropInViewController = braintree!.dropInViewControllerWithDelegate(self)
dropInViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Cancel, target: self, action: Selector("userDidCancel"))
dropInViewController.summaryTitle = "Pass"
dropInViewController.summaryDescription = "Purchase the product"
dropInViewController.displayAmount = "$5"
var navigationController: UINavigationController = UINavigationController(rootViewController: dropInViewController)
self.presentViewController(navigationController, animated: true, completion: nil)
}
and here's the error I'm getting when I touch the button to show the Braintree Drop In View
2015-12-15 20:06:39.764 TheDiner[1169:22409] +[UIColor bt_colorWithBytesR:G:B:]: unrecognized selector sent to class 0x104e4abc8
2015-12-15 20:06:39.828 TheDiner[1169:22409] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIColor bt_colorWithBytesR:G:B:]: unrecognized selector sent to class 0x104e4abc8'
*** First throw call stack:
(
0 CoreFoundation 0x000000010565bc65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001061dcbb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000105662fad +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001055b913c ___forwarding___ + 988
4 CoreFoundation 0x00000001055b8cd8 _CF_forwarding_prep_0 + 120
5 TheDiner 0x0000000103004f70 -[BTUI borderColor] + 64
6 TheDiner 0x0000000102fd8564 -[BTDropInContentView initWithFrame:] + 964
7 UIKit 0x00000001040d7393 -[UIView init] + 62
8 TheDiner 0x00000001030f794e -[BTUIThemedView init] + 62
9 TheDiner 0x0000000102fe0cb2 -[BTDropInViewController initWithClient:] + 226
10 TheDiner 0x0000000102fbfba1 -[Braintree dropInViewControllerWithDelegate:] + 209
11 TheDiner 0x0000000102fa9e7c _TFC8TheDiner22ZiftPassViewController16purchaseZiftPassfS0_FPSs9AnyObject_T_ + 572
12 TheDiner 0x0000000102faa206 _TToFC8TheDiner22ZiftPassViewController16purchaseZiftPassfS0_FPSs9AnyObject_T_ + 54
13 UIKit 0x0000000104075d62 -[UIApplication sendAction:to:from:forEvent:] + 75
14 UIKit 0x000000010418750a -[UIControl _sendActionsForEvents:withEvent:] + 467
15 UIKit 0x00000001041868d9 -[UIControl touchesEnded:withEvent:] + 522
16 UIKit 0x00000001040c2958 -[UIWindow _sendTouchesForEvent:] + 735
17 UIKit 0x00000001040c3282 -[UIWindow sendEvent:] + 682
18 UIKit 0x0000000104089541 -[UIApplication sendEvent:] + 246
19 UIKit 0x0000000104096cdc _UIApplicationHandleEventFromQueueEvent + 18265
20 UIKit 0x000000010407159c _UIApplicationHandleEventQueue + 2066
21 CoreFoundation 0x000000010558f431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22 CoreFoundation 0x00000001055852fd __CFRunLoopDoSources0 + 269
23 CoreFoundation 0x0000000105584934 __CFRunLoopRun + 868
24 CoreFoundation 0x0000000105584366 CFRunLoopRunSpecific + 470
25 GraphicsServices 0x0000000107c0fa3e GSEventRunModal + 161
26 UIKit 0x00000001040748c0 UIApplicationMain + 1282
27 TheDiner 0x0000000102fbea37 main + 135
28 libdyld.dylib 0x000000010694d145 start + 1
29 ??? 0x0000000000000001 0x0 + 1
)
I'm using Xcode 6 for ios8. I have the braintree header file in the bridging header.
#import <Braintree/Braintree.h>
#endif
Please point me in the right direction I've been stuck on this for a few hours. I'm thinking maybe I need to import another header in my bridge file but when I do it gives errors as well. Thanks

So the issue causing the crash is this:
5 TheDiner 0x0000000103004f70 -[BTUI borderColor] + 64
It appears that borderColor is a class method on BTUI, but that method calls +[UIColor bt_colorWithBytesR:G:B:], and the runtime can't find the implementation for +[UIColor bt_colorWithBytesR:G:B:]. This method is defined in UIColor+BTUI.h
Make sure you that you were able to import all of the headers for Brain Tree in the bridging header if you are using swift.
Try importing the header for the category file UIColor+BTUI.h manually in the bridging header and do a clean build and try again....
Updated Steps:
I got this to work, looks like something is messed up in your project file... I ran into the same problems you were having. But try these steps:
1) Create a new xcode project, (no need for bridged headers file).
2) Then change your podfile to:
use_frameworks!
pod 'Braintree', '~> 3.9'
then do a pod update
3)then at the top of your ViewController class add import Braintree then do a clean build

Related

NSUndoManager errors with "unrecognized selector sent to instance"

Working on implementing NSUndoManager within an iOS9 app. Current undo code looks like this:
func setActiveColorData(colorData: ColorData) {
if colorData != activeColorData {
print(self)
undoManager?.registerUndoWithTarget(self, selector: "setActiveColorData:", object: activeColorData!)
undoManager?.setActionName("Change color")
print("Set undo action")
activeColorData = colorData
}
}
ColorData is just a simple class with three floats inside of it (hue, saturation, brightness) and some utility methods.
Everything works fine, including the shake gesture which brings up the undo prompt. But once you click undo, the app crashes and the following error:
2016-02-25 16:26:58.225 Color[89399:5503615] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Color.PickerViewController setActiveColorData:]: unrecognized selector sent to instance 0x7fa080776820'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105b75e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000108159deb objc_exception_throw + 48
2 CoreFoundation 0x0000000105b7e48d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000105acb90a ___forwarding___ + 970
4 CoreFoundation 0x0000000105acb4b8 _CF_forwarding_prep_0 + 120
5 Foundation 0x00000001066b2feb -[_NSUndoStack popAndInvoke] + 261
6 Foundation 0x00000001066b2162 -[NSUndoManager undoNestedGroup] + 424
7 UIKit 0x0000000106c46813 -[UIApplication alertView:clickedButtonAtIndex:] + 151
8 UIKit 0x0000000106f63589 -[UIAlertView _prepareToDismissForTappedIndex:] + 136
9 UIKit 0x0000000106f62fc7 __35-[UIAlertView _prepareAlertActions]_block_invoke50 + 53
10 UIKit 0x0000000106f54572 -[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:] + 133
11 UIKit 0x0000000107604eb6 -[_UIAlertControllerView _handleActionSelectionGestureRecognizer:] + 694
12 UIKit 0x000000010711ee73 _UIGestureRecognizerSendTargetActions + 153
13 UIKit 0x000000010711b4e5 _UIGestureRecognizerSendActions + 162
14 UIKit 0x00000001071194e2 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 843
15 UIKit 0x00000001071219a0 ___UIGestureRecognizerUpdate_block_invoke904 + 79
16 UIKit 0x000000010712183e _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 342
17 UIKit 0x000000010710f101 _UIGestureRecognizerUpdate + 2634
18 UIKit 0x0000000106ca6f8a -[UIWindow _sendGesturesForEvent:] + 1137
19 UIKit 0x0000000106ca81c0 -[UIWindow sendEvent:] + 849
20 UIKit 0x0000000106c56b66 -[UIApplication sendEvent:] + 263
21 UIKit 0x0000000106c30d97 _UIApplicationHandleEventQueue + 6844
22 CoreFoundation 0x0000000105aa1a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
23 CoreFoundation 0x0000000105a9795c __CFRunLoopDoSources0 + 556
24 CoreFoundation 0x0000000105a96e13 __CFRunLoopRun + 867
25 CoreFoundation 0x0000000105a96828 CFRunLoopRunSpecific + 488
26 GraphicsServices 0x000000010a416ad2 GSEventRunModal + 161
27 UIKit 0x0000000106c36610 UIApplicationMain + 171
28 Color 0x00000001052a2a7d main + 109
29 libdyld.dylib 0x0000000108c9992d start + 1
30 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I've check the PickerViewController instance and the memory locations match up (from the print(self) line, in this case 0x7fa080776820). Any idea why it can't invoke this selector? Or is it something else? Thanks!
I'm seeing this same kind of crash in a photo editing app when memory is running low. When I get a memory warning, I clear the undo manager but in my case I believe this crash happens because the memory is getting deleted out from under the undo manager.
In case it's related: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/UndoArchitecture/Articles/CleaningUndoStack.html

iOS app crashes when Podfile has 'use_frameworks!' option

I have a Single View app setup with CocoaPods that includes only two pods, 'MBProgressHUB' and 'ImojiSDK'.
When CocoaPods is setup as a static library, the project builds and runs normally. When I configure CocoaPods to use frameworks, by including the 'use_frameworks!' flag in the Podfile, the project builds, but crashes when run.
Question is, why does it run fine as a static library, but not when using frameworks?
The crash happens when I try to create a new ImojiSDK session in the view's viewDidLoad:
IMImojiSession *session = [IMImojiSession imojiSession]; //THIS IS WHERE IT CRASHES
session.contentCache = [[NSCache alloc] init];
session.contentCache.countLimit = 100;
Below are the Podfile and crash output from Xcode:
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)
use_frameworks! enables Swift support by building your code in the new dynamic frameworks. Dynamic frameworks only support iOS 8
CocoaPods 0.36 - Framework and Swift Support
The ImojiSDK pod was recently updated for frameworks compatibility.
https://github.com/imojiengineering/imoji-ios-sdk

uncaught exception of type NSException (connections seem fine) - Wenderlich tutorial

I'm a beginner working through Ray Wenderlich's Swift tutorial, Part 2.
The final code for the lesson (and with which I'm receiving the error) is here: http://cdn5.raywenderlich.com/wp-content/uploads/2014/06/TipCalculator-Demo4.zip
When I build the app through Xcode 6.3.2 and run it on the iOS simulator (iPhone 6), I get the error message below (sorry for the poor formatting).
I did a search on both Google and StackOverflow, seems like people often run into similar errors but are able to fix it by going to the view controller, checking the Connections Inspector, and fixing any of the connections that are flagged (e.g., an object being connected to no longer exists).
Note: I don't have any flags in my Connections Inspector -- everything seems fine there, including the connection between resultsTextView and Text View object in the Storyboard (please see attached photo)
Please let me know how to solve this - thanks.
---------See Connection Inspector on far right - looks fine!-----------
http://i.imgur.com/X6eA05F.png
---------Error message---------
2015-06-05 17:07:39.866 TipCalculator[4848:128801] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key resultsTextView.'
* First throw call stack:
(
0 CoreFoundation 0x0000000100216c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000101d81bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001002168a9 -[NSException raise] + 9
3 Foundation 0x0000000100634b53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010015ed50 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x0000000100d8d52b -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x0000000100be5718 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x0000000100be5d08 -[UIViewController loadView] + 109
8 UIKit 0x0000000100be5f79 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x0000000100c1601b -[UINavigationController _layoutViewController:] + 44
10 UIKit 0x0000000100c16565 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 216
11 UIKit 0x0000000100c16664 -[UINavigationController _startTransition:fromViewController:toViewController:] + 92
12 UIKit 0x0000000100c17448 -[UINavigationController _startDeferredTransitionIfNeeded:] + 523
13 UIKit 0x0000000100c17f0e -[UINavigationController __viewWillLayoutSubviews] + 43
14 UIKit 0x0000000100d62715 -[UILayoutContainerView layoutSubviews] + 202
15 UIKit 0x0000000100b35a2b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
16 QuartzCore 0x0000000104916ec2 -[CALayer layoutSublayers] + 146
17 QuartzCore 0x000000010490b6d6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
18 QuartzCore 0x000000010490b546 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
19 QuartzCore 0x0000000104877886 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
20 QuartzCore 0x0000000104878a3a _ZN2CA11Transaction6commitEv + 462
21 UIKit 0x0000000100ab3a2d -[UIApplication _reportMainSceneUpdateFinished:] + 44
22 UIKit 0x0000000100ab46f1 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2648
23 UIKit 0x0000000100ab30d5 -[UIApplication workspaceDidEndTransaction:] + 179
24 FrontBoardServices 0x00000001038915e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
25 CoreFoundation 0x000000010014a41c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
26 CoreFoundation 0x0000000100140165 __CFRunLoopDoBlocks + 341
27 CoreFoundation 0x000000010013f947 __CFRunLoopRun + 887
28 CoreFoundation 0x000000010013f366 CFRunLoopRunSpecific + 470
29 UIKit 0x0000000100ab2b42 -[UIApplication _run] + 413
30 UIKit 0x0000000100ab5900 UIApplicationMain + 1282
31 TipCalculator 0x000000010002c177 main + 135
32 libdyld.dylib 0x00000001024d9145 start + 1
33 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Make sure you follow those steps correctly:
Open Main.storyboard and select your View Controller in the Document
Outline. Open the Connections Inspector (6th tab), and you will see
all of the properties you created listed in the Outlets section.
021_ConnectionsInspector You’ll notice a small circle to the right of
resultsTextView. Control-drag from that button down to the text view
below the Calculate button, and release to connect your Swift property
to this view.
I believe you are missing the #IBOutlet that is create in this step

PayPal integrated iOS 8 App

I have downloaded and played with the github project for the paypal ios app.
https://github.com/paypal/PayPal-iOS-SDK
I ran it just fine without any errors. When I try to link it into my iOS 8 swift project I can load all the files and connect the view controllers just fine and I believe my bridge header file is working just fine. I basically moved all the viewcontroller files from the sample app into my project and just connected what I needed to. I have the client id and secret id working I believe. It is when I try to create a FuturePaymentViewController :
- (IBAction)getUserAuthorizationForFuturePayments:(id)sender {
NSLog(#"\n\n\nbegin getting user authorization\n\n\nPAYPAL CONFIG:::: %#", self.payPalConfig);
PayPalFuturePaymentViewController *futurePaymentViewController = [[PayPalFuturePaymentViewController alloc] initWithConfiguration:self.payPalConfig delegate:self];
//breaks here when trying to send the config init.
NSLog(#"\n\n\nafter initializtion of paypal future payment view controller\n\n\n");
[self presentViewController:futurePaymentViewController animated:YES completion:nil];
NSLog(#"after present");
}
Error I get is :
PAYPAL CONFIG:::: <PayPalConfiguration: 0x7fb23e212af0>
2014-10-12 16:31:38.979 Project[2161:69146] -[PayPalFuturePaymentViewController payPalServiceManager]: unrecognized selector sent to instance 0x7fb23e2207d0
2014-10-12 16:31:38.981 Project[2161:69146] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PayPalFuturePaymentViewController payPalServiceManager]: unrecognized selector sent to instance 0x7fb23e2207d0'
*** First throw call stack:
(
0 CoreFoundation 0x00000001055bf3f5 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000105258bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001055c650d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010551e7fc ___forwarding___ + 988
4 CoreFoundation 0x000000010551e398 _CF_forwarding_prep_0 + 120
5 CutInLineSwift 0x000000010262c0b1 -[PayPalFuturePaymentViewController initWithConfiguration:delegate:] + 361
6 CutInLineSwift 0x00000001025d28de -[ZZMainViewController getUserAuthorizationForFuturePayments:] + 190
7 UIKit 0x00000001029639ee -[UIApplication sendAction:to:from:forEvent:] + 75
8 UIKit 0x0000000102a69bd0 -[UIControl _sendActionsForEvents:withEvent:] + 467
9 UIKit 0x0000000102a68f9f -[UIControl touchesEnded:withEvent:] + 522
10 UIKit 0x00000001029a93b8 -[UIWindow _sendTouchesForEvent:] + 735
11 UIKit 0x00000001029a9ce3 -[UIWindow sendEvent:] + 683
12 UIKit 0x0000000102976ae1 -[UIApplication sendEvent:] + 246
13 UIKit 0x0000000102983bad _UIApplicationHandleEventFromQueueEvent + 17370
14 UIKit 0x000000010295f233 _UIApplicationHandleEventQueue + 1961
15 CoreFoundation 0x00000001054f4ad1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
16 CoreFoundation 0x00000001054ea99d __CFRunLoopDoSources0 + 269
17 CoreFoundation 0x00000001054e9fd4 __CFRunLoopRun + 868
18 CoreFoundation 0x00000001054e9a06 CFRunLoopRunSpecific + 470
19 GraphicsServices 0x00000001071eb9f0 GSEventRunModal + 161
20 UIKit 0x0000000102962550 UIApplicationMain + 1282
21 CutInLineSwift 0x00000001025d093e top_level_code + 78
22 CutInLineSwift 0x00000001025d097a main + 42
23 libdyld.dylib 0x0000000105f93145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
This should not be breaking since no different from the sample project but I have no idea why it is. Please help me, thank you!
Dave from PayPal here.
I believe that your problem will be solved by step 3 of our integration instructions:
In your project's Build Settings (in the TARGETS section, not the PROJECTS section):
add -lc++ -ObjC to Other Linker Flags
Also, please note Step 1 of our sample code, which indicates that you must call [PayPalMobile initializeWithClientIdsForEnvironments:] to initialize the SDK, prior to calling other methods.

ObjectiveRecord nil model error

For the first time I'm trying to use CocoaPods and ObjectiveRecord. ObjectiveRecord's github page
When I try to save my object, I get the following error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'
*** First throw call stack:
(
0 CoreFoundation 0x01aae5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018318b6 objc_exception_throw + 44
2 CoreData 0x00023b0e -[NSPersistentStoreCoordinator initWithManagedObjectModel:] + 398
3 ObjectiveRecordTest 0x00003691 -[CoreDataManager persistentStoreCoordinatorWithStoreType:storeURL:] + 193
4 ObjectiveRecordTest 0x000030f9 -[CoreDataManager persistentStoreCoordinator] + 169
5 ObjectiveRecordTest 0x00002dba -[CoreDataManager managedObjectContext] + 106
6 ObjectiveRecordTest 0x00003f26 +[NSManagedObjectContext(ActiveRecord) defaultContext] + 86
7 ObjectiveRecordTest 0x0000477a +[NSManagedObject(ActiveRecord) create] + 58
8 ObjectiveRecordTest 0x00002112 -[ViewController savePressed:] + 82
9 libobjc.A.dylib 0x01843874 -[NSObject performSelector:withObject:withObject:] + 77
10 UIKit 0x005a10c2 -[UIApplication sendAction:to:from:forEvent:] + 108
11 UIKit 0x005a104e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
12 UIKit 0x006990c1 -[UIControl sendAction:to:forEvent:] + 66
13 UIKit 0x00699484 -[UIControl _sendActionsForEvents:withEvent:] + 577
14 UIKit 0x00698733 -[UIControl touchesEnded:withEvent:] + 641
15 UIKit 0x005de51d -[UIWindow _sendTouchesForEvent:] + 852
16 UIKit 0x005df184 -[UIWindow sendEvent:] + 1232
17 UIKit 0x005b2e86 -[UIApplication sendEvent:] + 242
18 UIKit 0x0059d18f _UIApplicationHandleEventQueue + 11421
19 CoreFoundation 0x01a3783f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
20 CoreFoundation 0x01a371cb __CFRunLoopDoSources0 + 235
21 CoreFoundation 0x01a5429e __CFRunLoopRun + 910
22 CoreFoundation 0x01a53ac3 CFRunLoopRunSpecific + 467
23 CoreFoundation 0x01a538db CFRunLoopRunInMode + 123
24 GraphicsServices 0x02e9e9e2 GSEventRunModal + 192
25 GraphicsServices 0x02e9e809 GSEventRun + 104
26 UIKit 0x0059fd3b UIApplicationMain + 1225
27 ObjectiveRecordTest 0x000028ad main + 141
28 libdyld.dylib 0x02b4070d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
This is what my Podfile looks like:
platform :ios
pod 'ObjectiveRecord'
I'm using the new xcworkspace file instead of the old xcode project file and I've imported the following two in the .pch file:
#import "ObjectiveRecord.h"
#import <CoreData/CoreData.h>
I've added Core Data in the project's settings page. Now when I'm using the provided code from the example of the github page:
Person *john = [Person create];
john.name = #"John";
[john save];
I get the error above. Have I forgotten something? I've been searching for some time now but I can't figure it out.
I'm using Xcode 5.0.2 and iOS 7.
Update:
It turns out that, in the general project settings, in the frameworks and libraries section, there is a red "libPods.a" entry. That means that it's missing, right? Could this be the issue?
From the doc:
Custom CoreData model or .sqlite database
If you've added the Core Data manually, you can change the custom model and database name on CoreDataManager
[CoreDataManager sharedManager].modelName = #"MyModelName";
[CoreDataManager sharedManager].databaseName = #"custom_database_name";
https://github.com/mneorr/ObjectiveRecord/blob/master/README.md
Reading docs will always help.
Ok, I fixed the error by renaming my Model.xcdatamodeld into appname.xcdatamodeld. I'm not sure why it fixed it but, I always named my models "Model" before, without any problems, but now it works. I hope this helps other people having this problem. I as well found out that the red colored "libPods.a" entry doesn't mean that it's missing. So even if it's red, everything is fine.

Resources