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

Framework not in DMG #2

Closed
unknowndomain opened this issue Sep 3, 2010 · 11 comments
Closed

Framework not in DMG #2

unknowndomain opened this issue Sep 3, 2010 · 11 comments
Labels
Milestone

Comments

@unknowndomain
Copy link

Hey all,

Just an FYI the framework, nor any of the files required to build the framework are included with the latest 2.3 DMG, I am not sure if this was deliberate but its very confusing to me that the source is only the .h and .m files and not the actual XCode project you would use to build the framework too?

@stig
Copy link
Collaborator

stig commented Sep 3, 2010

It is deliberate, because so many people tried to use the framework in their iPhone app. (Which obviously doesn't work.)

The "source" is literally that - classes for you to drop into your existing project, to make it as simple as possible to use. If you want to build the framework, just download it from github.

I can see it being confusing though, and would like to hear suggestions for how to improve the situation.

@unknowndomain
Copy link
Author

Sure but the thing is that I did the exact opposite, I tried to drop the source files into my Mac app and it didn't work because you have a conditional include in the JSON.h file...

#if (TARGET_OS_IPHONE)
...
#else
...
#endif

...It presumes that the target OS must be Mac and that it must be in the form of a framework.

My suggestion would be to include both, one in a folder named iPhone, another in a folder named Mac...

Alternatively you could put up a JSON_(iPhone)2.3.dmg and JSON(Mac)_2.3.dmg

@stig
Copy link
Collaborator

stig commented Sep 3, 2010

I'm confused; I don't understand why dropping the JSON folder into your application doesn't work for you - it work for me, but only with the conditional you cite above in place...

@unknowndomain
Copy link
Author

Okay, so you drop the folder from the DMG into your Classes folder as advised, add the #include "JSON.h", then compile...

You can't use <JSON/JSON.h> because its not a framework its just a class at this point, and if you use "JSON.h" it says its not able to find the other files because again they are referenced as <JSON/Whatever.h> in JSON.h.

So you have to either edit the Mac includes not to use the framework style include or you have to provide the xcode project so the person can use that to compile the framework them selves.

If you only give the classes then they can't use those.

@stig
Copy link
Collaborator

stig commented Sep 3, 2010

I don't understand why you can't use <JSON/JSON.h> in your app. Your Classes folder surely is on your include path? It should just work, I thought.

I'm assuming that you end up with Classes/JSON/JSON.h, and not Classes/JSON.h by the way.

@unknowndomain
Copy link
Author

Because if you simply include those files... you should be using #include "JSON.h"

Where as if its an actual real .framework folder it should be #include <JSON/JSON.h>

However as you don't provide either the source code to make a .framework nor the actual compiled framework that means you are limited to only being able to use #include "JSON.h" and because again your code expects if its a Mac OS not iOS device that the files are in a .framework it looks for the other headers in #include <JSON/***.h> which is again wrong because you are talking about a set of classes not a framework.

Does this make sense?

@stig
Copy link
Collaborator

stig commented Sep 3, 2010

Hmm... I think I see it now.

Do you have any suggestions for how to make this work properly in all these cases?

  • on iPhone, copy sources
  • on iPhone, link to libjson.a
  • on Mac, copy sources
  • on Mac, link to JSON.framework

I think the first three should be similar, but the last is not. Suggestions?

@unknowndomain
Copy link
Author

Well again I think your missing the point...

There is no JSON.framework in the DMG compiled or otherwise and simply creating an XCode Cocoa Framework project and dragging the files in is not enough to build a framework and its already to complicated, you need to add the entire source and XCode project into the DMG, I suggest as either:

  • Two different DMGs (iPhone & Mac)
  • One DMG with two folders (iPhone & Mac)
  • One DMG with one folder (Mac) and clear instructions on where the source code is for iPhone users.

It seems like you've fixed the simple iPhone problem in exchange for a more complicated Mac one.

@stig
Copy link
Collaborator

stig commented Sep 4, 2010

I don't think I'm missing the point. The lack of a JSON.framework or .xcodeproj in the DMG is deliberate. The DMG is meant to be the simplest possible way to get started using JSON in your application, be it for the iPhone or the Mac.

Regardless of whether you're writing an iPhone or Mac application you should be able to just drag the "JSON" folder into your app compile, and go. This works just fine for me. That it doesn't work for you (and others) is a bug. Let that be clear.

Advanced users (like you and I) prefer to link to the framework rather than copying the sources. However, some people want debug information and others don't; I don't want to provide all permutations, so don't want to distribute binaries.

For the Mac it is relatively simple to just do external dependency on the project. You can do that with the unchanged source tree downloaded straight off github. I agree that it's not as well advertised as the DMG, but if you visit the download page you'll find tar/zip files for both the master branch and tag v2.3 ready for download.

Here are two example projects (as I'm sure you don't need, but can be useful to others reading this ticket):

@gradyplayer
Copy link

yeah i had this problem too, what i did what just remove those preprocessor directives and run vanilla imports, the assumption being that we would use as a framework if it were not an iphone project...

#import "SBJsonParser.h"
#import "SBJsonWriter.h"
#import "NSObject+SBJSON.h"
#import "NSString+SBJSON.h"

@stig
Copy link
Collaborator

stig commented Sep 22, 2010

I've just pushed a new branch, nodmg, where I try to address this problem. Can you please check it out and see if it fixes it?

Get branch as .zip file

What I've done is just use the simple #import "..." style by default, and transform that at build time into the proper framework/library style. I think this should cover all use cases.

Lennie1988 pushed a commit to Lennie1988/json-framework that referenced this issue Sep 6, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants