Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking Storyboard to Main Project #66

Open
cmconlan opened this issue Nov 13, 2013 · 10 comments
Open

Linking Storyboard to Main Project #66

cmconlan opened this issue Nov 13, 2013 · 10 comments

Comments

@cmconlan
Copy link

Hi there,

This framework guide is excellent and has taken us really close to our goal for our particular project, so thank you for that.

We are experiencing a slight problem; we want to create storyboards in the framework and use these in the "main" project. We are including the storyboards into the bundle which goes up to the main project. We can call the storyboard and see it in the app when it is built, however we can not include a view controller. Xcode will say it cannot find the view controller.

The view controller is also sat within the framework and imported into the project at build stage, however there seems to be a disconnect between the storyboard and viewcontroller when one is being submitted via a bundle, and other through the standard import procedure.

We've attempted adding the view controller to the bundle, however it does not like this as it will not allow the .h file into a bundle. I have also tried inverting the dependencies so the framework becomes a dependency of the bundle (thinking was that it would cause all the classes therein, inc viewcontroller, to load first).

I wondered if this is something you have encountered on your work on frameworking, and if so if you know a fix.

Many thanks,

Chris

@PaulSolt
Copy link
Collaborator

You need to load the storyboard from the Framework Bundle path, it will fail to load from the app's bundle path, because it's not there.

  1. Load storyboard programmatically http://stackoverflow.com/questions/9896406/how-can-i-load-storyboard-programmatically-from-class
  2. Use the bundle loading code https://github.com/jverkoey/iOS-Framework#step-5-loading-bundle-resources

@Mrithula
Copy link

Hi, Im have come up at this same problem, but mine is a slightly different issue. I loaded the storyboard from the bundle and I get this error ''[<UIViewController 0x8ab1f80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key'.
I have a label connected to from SB to the view controller. when i try to disconnect it, it works fine. Please help me.

@PaulSolt
Copy link
Collaborator

Sounds like you have a connection to a IBOutlet or IBAction that doesn't
exist in code.

Right click and check all connections in the storyboard.

-Paul Solt

On Sat, Jan 25, 2014 at 7:24 AM, Mrithula notifications@github.com wrote:

Hi, Im have come up at this same problem, but mine is a slightly different
issue. I loaded the storyboard from the bundle and I get this error ''[
setValue:forUndefinedKey:]: this class is not key value coding-compliant
for the key'.
I have a label connected to from SB to the view controller. when i try to
disconnect it, it works fine. Please help me.


Reply to this email directly or view it on GitHubhttps://github.com//issues/66#issuecomment-33287776
.

Paul Solt
PaulSolt@gmail.com
215-341-0407 (Cell)
http://www.PaulSolt.com/

Creative apps for iPhone and iPad: http://www.ArtworkEvolution.com/

@Mrithula
Copy link

Hi, I checked and have all connections. I saw same problem here http://stackoverflow.com/questions/19954771/ios-linking-framework-storyboard-to-viewcontroller-for-use-in-main-project, but i cannot set that flag, as i have another framework in this bundle.

@Mrithula
Copy link

Hi, this is the crash I get.

Unknown class NewViewController in Interface Builder file.
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x8a9c760> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key newLabel.'
*** First throw call stack:
(
0 CoreFoundation 0x017345e4 exceptionPreprocess + 180
1 libobjc.A.dylib 0x014b78b6 objc_exception_throw + 44
2 CoreFoundation 0x017c46a1 -[NSException raise] + 17
3 Foundation 0x01178c2e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x010e4f3b _NSSetUsingKeyValueSetter + 88
5 Foundation 0x010e4493 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6 Foundation 0x0114694a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7 UIKit 0x004cbcd5 -[UIRuntimeOutletConnection connect] + 106
8 libobjc.A.dylib 0x014c97d2 -[NSObject performSelector:] + 62
9 CoreFoundation 0x0172fb6a -[NSArray makeObjectsPerformSelector:] + 314
10 UIKit 0x004ca82e -[UINib instantiateWithOwner:options:] + 1417
11 UIKit 0x0033cc95 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
12 UIKit 0x0033d43d -[UIViewController loadView] + 302
13 UIKit 0x0033d73e -[UIViewController loadViewIfRequired] + 78
14 UIKit 0x0033dc44 -[UIViewController view] + 35
15 UIKit 0x0034d149 -[UIViewController shouldAutorotate] + 36
16 UIKit 0x0034d491 -[UIViewController _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:] + 297
17 UIKit 0x005d16e5 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:] + 2330
18 UIKit 0x0034978c -[UIViewController presentViewController:withTransition:completion:] + 6433
19 UIKit 0x00349caf -[UIViewController presentViewController:animated:completion:] + 130
20 TestingCheck 0x000027e8 -[ViewController helloclieckd:] + 232
21 libobjc.A.dylib 0x014c9874 -[NSObject performSelector:withObject:withObject:] + 77
22 UIKit 0x0022bc8c -[UIApplication sendAction:to:from:forEvent:] + 108
23 UIKit 0x0022bc18 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
24 UIKit 0x003236d9 -[UIControl sendAction:to:forEvent:] + 66
25 UIKit 0x00323a9c -[UIControl _sendActionsForEvents:withEvent:] + 577
26 UIKit 0x00322d4b -[UIControl touchesEnded:withEvent:] + 641
27 UIKit 0x002690cd -[UIWindow _sendTouchesForEvent:] + 852
28 UIKit 0x00269d34 -[UIWindow sendEvent:] + 1232
29 UIKit 0x0023da36 -[UIApplication sendEvent:] + 242
30 UIKit 0x00227d9f _UIApplicationHandleEventQueue + 11421
31 CoreFoundation 0x016bd8af __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 15
32 CoreFoundation 0x016bd23b __CFRunLoopDoSources0 + 235
33 CoreFoundation 0x016da30e __CFRunLoopRun + 910
34 CoreFoundation 0x016d9b33 CFRunLoopRunSpecific + 467
35 CoreFoundation 0x016d994b CFRunLoopRunInMode + 123
36 GraphicsServices 0x036d59d7 GSEventRunModal + 192
37 GraphicsServices 0x036d57fe GSEventRun + 104
38 UIKit 0x0022a94b UIApplicationMain + 1225
39 TestingCheck 0x00002c3d main + 141
40 libdyld.dylib 0x01d7270d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

@PaulSolt
Copy link
Collaborator

  1. Is the interface (all views/viewcontrollers) being loaded from the
    bundle?

https://github.com/jverkoey/iOS-Framework#step-5-loading-bundle-resources

  1. Did you disable code stripping on the project?
    https://github.com/jverkoey/iOS-Framework#step-4-disable-code-stripping
  2. Try and recreate the project following the steps and see if you can get
    a test Xcode project working correctly.

-Paul Solt

On Sun, Jan 26, 2014 at 10:52 PM, Mrithula notifications@github.com wrote:

Hi, this is the crash I get.

Unknown class NewViewController in Interface Builder file.
*** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[ setValue:forUndefinedKey:]: this class is not key value
coding-compliant for the key newLabel.'
*** First throw call stack:
(
0 CoreFoundation 0x017345e4

*exceptionPreprocess + 180 1 libobjc.A.dylib 0x014b78b6
objc_exception_throw + 44 2 CoreFoundation 0x017c46a1 -[NSException raise]

  • 17 3 Foundation 0x01178c2e -[NSObject(NSKeyValueCoding)
    setValue:forUndefinedKey:] + 282 4 Foundation 0x010e4f3b
    NSSetUsingKeyValueSetter + 88 5 Foundation 0x010e4493
    -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267 6 Foundation
    0x0114694a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412 7 UIKit
    0x004cbcd5 -[UIRuntimeOutletConnection connect] + 106 8 libobjc.A.dylib
    0x014c97d2 -[NSObject performSelector:] + 62 9 CoreFoundation 0x0172fb6a
    -[NSArray makeObjectsPerformSelector:] + 314 10 UIKit 0x004ca82e -[UINib
    instantiateWithOwner:options:] + 1417 11 UIKit 0x0033cc95
    -[UIViewController _loadViewFromNibNamed:bundle:] + 280 12 UIKit 0x0033d43d
    -[UIViewController loadView] + 302 13 UIKit 0x0033d73e -[UIViewController
    loadViewIfRequired] + 78 14 UIKit 0x0033dc44 -[UIViewController view] + 35
    15 UIKit 0x0034d149 -[UIViewController shouldAutorotate] + 36 16 UIKit
    0x0034d491 -[UIViewController
    _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:]
  • 297 17 UIKit 0x005d16e5 -[UIWindowController
    transition:fromViewController:toViewController:target:didEndSelector:animation:]
  • 2330 18 UIKit 0x0034978c -[UIViewController
    presentViewController:withTransition:completion:] + 6433 19 UIKit
    0x00349caf -[UIViewController presentViewController:animated:completion:] +
    130 20 TestingCheck 0x000027e8 -[ViewController helloclieckd:] + 232 21
    libobjc.A.dylib 0x014c9874 -[NSObject
    performSelector:withObject:withObject:] + 77 22 UIKit 0x0022bc8c
    -[UIApplication sendAction:to:from:forEvent:] + 108 23 UIKit 0x0022bc18
    -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61 24 UIKit
    0x003236d9 -[UIControl sendAction:to:forEvent:] + 66 25 UIKit 0x00323a9c
    -[UIControl _sendActionsForEvents:withEvent:] + 577 26 UIKit 0x00322d4b
    -[UIControl touchesEnded:withEvent:] + 641 27 UIKit 0x002690cd -[UIWindow
    _sendTouchesForEvent:] + 852 28 UIKit 0x00269d34 -[UIWindow sendEvent:] +
    1232 29 UIKit 0x0023da36 -[UIApplication sendEvent:] + 242 30 UIKit
    0x00227d9f _UIApplicationHandleEventQueue + 11421 31 CoreFoundation
    0x016bd8af _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION* + 15
    32 CoreFoundation 0x016bd23b __CFRunLoopDoSources0 + 235
    33 CoreFoundation 0x016da30e __CFRunLoopRun + 910
    34 CoreFoundation 0x016d9b33 CFRunLoopRunSpecific + 467
    35 CoreFoundation 0x016d994b CFRunLoopRunInMode + 123
    36 GraphicsServices 0x036d59d7 GSEventRunModal + 192
    37 GraphicsServices 0x036d57fe GSEventRun + 104
    38 UIKit 0x0022a94b UIApplicationMain + 1225
    39 TestingCheck 0x00002c3d main + 141
    40 libdyld.dylib 0x01d7270d start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException


Reply to this email directly or view it on GitHubhttps://github.com//issues/66#issuecomment-33340669
.

Paul Solt
PaulSolt@gmail.com
215-341-0407 (Cell)
http://www.PaulSolt.com/

Creative apps for iPhone and iPad: http://www.ArtworkEvolution.com/

@Mrithula
Copy link

Thanks Paul, its working fine now.
But I have another question, right now i have all the images in my bundle, can i hide some of them so that no one can replace it ?

@a3kulkarni
Copy link

Hi Mrithula,
I am getting exactly same exception when I try to load the storyboard from the framework.

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x109116010> setValue:forUndefinedKey:]:

Could you please share the steps to resolve this issue?

Thanks
Aniruddha

@Mrithula
Copy link

Hi,
I solved it by setting 'other linker flag to' -ObjC. If u still have
problem try setting it to -all_load -ObjC.
Hope it works.

On Thu, Jan 30, 2014 at 4:52 AM, a3kulkarni notifications@github.comwrote:

Hi Mrithula,
I am getting exactly same exception when I try to load the storyboard from
the framework.

*** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[ setValue:forUndefinedKey:]:

Could you please share the steps to resolve this issue?

Thanks
Aniruddha

Reply to this email directly or view it on GitHubhttps://github.com//issues/66#issuecomment-33643696
.

@a3kulkarni
Copy link

Ok. Thanks, it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants