dingbat / nsrails

iOS/Mac OS framework for Rails
http://nsrails.com
MIT License
517 stars 37 forks source link

Is there a clash between 'NSRails' and 'NSData+Base64' pods? #39

Closed matthewsinclair closed 11 years ago

matthewsinclair commented 11 years ago

If I'm reading the tea-leaves properly, it seems that NSRails is doing something under the hood with 'NSData+Base64'. If I include the pod 'NSData+Base64' into my RubyMotion project, I get a compile error inside NSRails. If I take it away, it works.

However, using 'base64EncodedString' on an NSData instance doesn't work, but I notice that using 'nsr_base64Encoding' does work.

Is this something worth fixing in NSRails, or is there some kind of config I can use to make it work? It's a little bit obtuse to have to use the nsr_ version.

dingbat commented 11 years ago

Interesting. I'm guessing this has to do with the fact that both NSData+Base64 and NSRails have a file named "NSData+Base64.h". But that this won't compile seems strange to me, since they both should be compiled into their own static libraries anyway during RubyMotion build, and, (to my knowledge) filenames shouldn't matter during linking. I haven't used RubyMotion for a while though (nor have I ever used it with pods), so I'm not sure this is the case anymore.

I suppose you could always alias_method it within your project to remove the nsr_.

Any more thoughts? What's the compile error you're getting, and at what point?

matthewsinclair commented 11 years ago

Here's the error with 'NSData+Base64' in the pods:

...
.../MyApp/vendor/Pods/NSRails/nsrails/Source/NSRRequest.m:322:67: error: no visible @interface for 'NSData' declares the selector 'nsr_base64Encoding'
                NSString *authHeader = [NSString stringWithFormat:@"Basic %@", [authData nsr_base64Encoding]];
...

For the moment, I'm ok with using the aliased version for what I need, so it's not a priority, but it might be worth working out why it happens because I'm sure that there's more than just me trying to use Base64 and NSRails.

dingbat commented 11 years ago

Should be fixed in 2.0.3. I've submitted a PR with CocoaPods, will post back when it's merged.

dingbat commented 11 years ago

@matthewsinclair It's been merged with pods master. Could you test & confirm that it's resolved?

matthewsinclair commented 11 years ago

No joy, sadly. I can use 2.0.3 ok, but if I add "NSData+Base64' as a pod, I still get the following error:

… The following build commands failed:

CompileC build/Pods.build/Release-iphonesimulator/Pods.build/Objects-normal/i386/NSRRequest.o NSRails/nsrails/Source/NSRRequest.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure) ...

Regards, M@

On 20/06/2013, at 4:45 AM, dan hassin notifications@github.com wrote:

@matthewsinclair It's been merged with pods master. Could you test & confirm that it's resolved?

— Reply to this email directly or view it on GitHub.

dingbat commented 11 years ago

Hm. This is very very strange. Are you sure NSRails was updated? Can you check the files, that the Base64 category is named NSData+NSRBase64.h?

I took a look at the NSData+Base64 pod. This and NSRails have absolutely nothing that would conflict. Any ideas?

matthewsinclair commented 11 years ago

Dan, You're right. Whatever I did previously didn't work, but now it seems to be working. I'd say that I ran 'pod install / pod update' in one of my projects, but not the other. Sorry for the confusion it's all working now. Thanks.

On 21/06/2013, at 5:06 PM, dan hassin notifications@github.com wrote:

Hm. This is very very strange. Are you sure NSRails was updated? Can you check the files, that the Base64 category is named NSData+NSRBase64.h?

I took a look at the NSData+NSRBase64 pod. This and NSRails have absolutely nothing that would conflict. Any ideas?

— Reply to this email directly or view it on GitHub.

dingbat commented 11 years ago

Cool, glad to hear.