ibm-mobile-push / ios

BY DOWNLOADING, INSTALLING, COPYING, ACCESSING, CLICKING ON AN “ACCEPT” BUTTON, OR OTHERWISE USING THE PROGRAM, LICENSEE AGREES TO THE TERMS OF THE LICENSE AGREEMENT.
https://github.com/ibm-mobile-push/ios/tree/master/license
7 stars 3 forks source link

@IBDesinable can't show custom view from xib. #2

Closed TucoBZ closed 7 years ago

TucoBZ commented 7 years ago

Hi there,

After installing the framework in my project I got a problem with IBDesinables, and it can't be displayed at storyboard.

I follow this instructions to install the framework: http://www.ibm.com/support/knowledgecenter/SSMRK7_3.0.0/AppPush/Apple_iOS/implement_ios_sdk.html

My project is a Swift with cocoapods 1.1.1

The IBDesginable crash file says: IBDesignablesAgentCocoaTouch_2016-11-30-162323-1_MacBook-Pro-de-Tulio.txt

Apparently is a problem with my MceConfig.json, but it is add in project and IBMMobilePush is working... Can you help with this?

Best Regards!

jbuchman commented 7 years ago

Can you try installing the framework directly in the app instead of through cocoapods?

From: TucoBZ notifications@github.com Reply-To: ibm-mobile-push/ios reply@reply.github.com Date: Wednesday, November 30, 2016 at 11:41 AM To: ibm-mobile-push/ios ios@noreply.github.com Subject: [ibm-mobile-push/ios] @IBDesinable can't show custom view from xib. (#2)

Hi there,

After installing the framework in my project I got a problem with IBDesinables, and it can't be displayed at storyboard.

I follow this instructions to install the framework: http://www.ibm.com/support/knowledgecenter/SSMRK7_3.0.0/AppPush/Apple_iOS/implement_ios_sdk.html

My project is a Swift with cocoapods 1.1.1

The IBDesginable crash file says: IBDesignablesAgentCocoaTouch_2016-11-30-162323-1_MacBook-Pro-de-Tulio.txt

Apparently is a problem with my MceConfig.json, but it is add in project and IBMMobilePush is working... Can you help with this?

Best Regards!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

TucoBZ commented 7 years ago

Actually, I am installing it directly.. I just supposed that cocoapods can interfere in something.

jbuchman commented 7 years ago

The console log is saying that it can’t find the MceConfig.json file, what are the contents of it? Are you sure it’s being included in the target? Can you see the file in the app bundle?

From: TucoBZ notifications@github.com Reply-To: ibm-mobile-push/ios reply@reply.github.com Date: Wednesday, November 30, 2016 at 11:48 AM To: ibm-mobile-push/ios ios@noreply.github.com Cc: Jeremy Buchman jeremy.buchman@gmail.com, Comment comment@noreply.github.com Subject: Re: [ibm-mobile-push/ios] @IBDesinable can't show custom view from xib. (#2)

Actually, I am installing it directly.. I just supposed that cocoapods can interfere in something.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

TucoBZ commented 7 years ago

There is the content, and it is included in the target and I can see it in the bundle too.

` { "appDelegateClass": "Project.AppDelegate",

"baseUrl": "https://api.ibm.xtify.com/3.0/",
"appKey": {
    "dev":"my key",
    "prod":"my key"
},
"autoInitializeFlag": true,
"sessionTimeout": 20,
"metricTimeInterval": 180,
"loglevel": "error",
"logfile": false

} `

PS: sorry but I needed to hide some info in the images...

screen shot 2016-11-30 at 21 15 54 screen shot 2016-11-30 at 21 14 47
jbuchman commented 7 years ago

It seems like the problem stems from trying to use the SDK with @IBDesignable which can’t work with it’s current implementation. Perhaps you can separate the code that uses the SDK from the @IBDesignable view in your project?

From: TucoBZ notifications@github.com Reply-To: ibm-mobile-push/ios reply@reply.github.com Date: Wednesday, November 30, 2016 at 4:32 PM To: ibm-mobile-push/ios ios@noreply.github.com Cc: Jeremy Buchman jeremy.buchman@gmail.com, Comment comment@noreply.github.com Subject: Re: [ibm-mobile-push/ios] @IBDesinable can't show custom view from xib. (#2)

There is the content, and it is included in the target and I can see it in the bundle too.

{ "appDelegateClass": "Project.AppDelegate", "baseUrl": "https://api.ibm.xtify.com/3.0/", "appKey": {     "dev":"my key",     "prod":"my key" }, "autoInitializeFlag": true, "sessionTimeout": 20, "metricTimeInterval": 180, "loglevel": "error", "logfile": false }

PS: sorry but I needed to hide some info in the images...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

TucoBZ commented 7 years ago

It's crashing all the storyboards with IBDesignable, and we just placed the framework in the project, with its configuration so there is no file using the framework yet.

GuilhermeMachado commented 7 years ago

Hi!

Below is the IBDesignablesAgentCocoaTouch log:

Application Specific Information:
*** Terminating app due to uncaught exception 'Config File Not Found', reason: 'Config file named MceConfig.json was expected in bundle but not found.'
terminating with uncaught exception of type NSException
abort() called
CoreSimulator 307.14.2 - Device: IBSimDeviceTypeiPad2x - Runtime: iOS 10.1 (14B72) - DeviceType: IBSimDeviceTypeiPad2x

Application Specific Backtrace 1:
0   CoreFoundation                      0x00000001100b634b __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x000000010fa2f21e objc_exception_throw + 48
2   CoreFoundation                      0x000000011011f265 +[NSException raise:format:] + 197
3   IBMMobilePush                       0x000000011bc7728d -[MCEConfig validateConfigDictionary:] + 168
4   IBMMobilePush                       0x000000011bc758e7 -[MCEConfig initWithDictionary:] + 106
5   IBMMobilePush                       0x000000011bc70187 -[MCESdk config] + 68
6   IBMMobilePush                       0x000000011bc63258 +[MCEAppDelegate instancesRespondToSelector:] + 107
7   <APPNAME>                              0x000000021d9d7314 +[FIRAAppDelegateProxy fulfillRequiredMethodsForAppDelegateClass:] + 55
8   <APPNAME>                              0x000000021d9d72ab +[FIRAAppDelegateProxy load] + 144
9   libobjc.A.dylib                     0x000000010fa312ce call_load_methods + 715
10  libobjc.A.dylib                     0x000000010fa31da3 load_images + 70
11  ???                                 0x000000010c5f4c5e 0x0 + 4502539358
12  ???                                 0x000000010c6000aa 0x0 + 4502585514
13  ???                                 0x000000010c5ff23a 0x0 + 4502581818
14  ???                                 0x000000010c5ff2cf 0x0 + 4502581967
15  ???                                 0x000000010c5f79eb 0x0 + 4502551019
16  ???                                 0x000000010c5fbc20 0x0 + 4502567968

When the interface builder "pre-build" all files to show in screen some files are automatic compiled on call_load_methods method. This may occur because of the +load method of the NSObject class.

Source: NSObject documentation

When this occurs your library tries to load the configuration file and forces the crash of the app. Because it tries to get this configuration file automatically.

All this runs in a simple build in the interface builder :(

If the library only displayed a message notifying that the file was not found instead of forcing the crash of the app would be much better.

GuilhermeMachado commented 7 years ago

Hi guys,

Any news about this problem?

jbuchman commented 7 years ago

This will be addressed in the 3.6.5.0 release. Sorry about the slow response, but it takes a little while to get it onto the release schedule