PDA

View Full Version : how to add a private framework?




MACloop
Jul 12, 2010, 05:18 AM
Hello,
I have downloaded a framework in order to be able to handle auth on the iPhone. I have problems though to add this framework to my projects...
This is how I did it:
I checked out the project here (http://code.google.com/p/mpoauthconnection/source/checkout)
I got a map with all files. As I understand I have to build the framework to be able to use it? So I opened the file MPOAuth.xcodeproj in xcode. Under the targets I then chose the framework and build. That was sucessfull regarding to Xcode. I took the framwork and dragged and droped it into my project and I right-clicked on the target in order to set a new build-phase. I chose Frameworks and dragged and dropped the added private framework as path. In the target hierarchy a new group was added called copy Files and into this group I dragged and dropped the framework. (I followed this tutorial (http://mojomonkeycoding.com/category/xcode/))

When I try to build and run the project I get 6 errors and they are all like this one:
in /Users/xxxxx/Desktop/test_MPO/Classes/MPOAuth.framework/MPOAuth, file was built for unsupported file format which is not the architecture being linked (i386)
"_MPOAuthNotificationAccessTokenReceived", referenced from:
_MPOAuthNotificationAccessTokenReceived$non_lazy_ptr in RootViewController.o
(maybe you meant: _MPOAuthNotificationAccessTokenReceived$non_lazy_ptr)

Does any one know what it means? What do I do wrong?
MACloop



robbieduncan
Jul 12, 2010, 05:19 AM
Looks like you build the framework for the device (ARM) and are trying to use it in the simulator (i386).

MACloop
Jul 12, 2010, 05:27 AM
Looks like you build the framework for the device (ARM) and are trying to use it in the simulator (i386).

ups...yes that might be right... Do I have to make one build for the simulator aswell in order to be abel to test it on the simulator?

MACloop
Jul 12, 2010, 05:37 AM
So I did the same as above except for that I picked the Base SDK to be iPhone Simulator 3.1.3 adn when building the framework I got this error:

target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphonesimulator' platform

Internal error occurred while creating dependency graph: ASSERTION FAILURE in /SourceCache/DevToolsBase/DevToolsBase-1648/pbxcore/Target.subproj/PBXTargetBuildContext.m:2061
Details: Assertion failed: [filePath isAbsolutePath]
Object: <PBXTargetBuildContext:0x201212e80>
Method: -setHeadermapToolInvocation:forFilePath:
Thread: <NSThread: 0x200ff46e0>{name = (null), num = 8}
Backtrace:
0 0x00000001002b517f -[PBXTargetBuildContext(DependencyGraphEvents) handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in DevToolsCore)
1 0x0000000100311c1a _XCAssertionFailureHandler (in DevToolsCore)
2 0x00000001002b17d8 -[PBXTargetBuildContext setHeadermapToolInvocation:forFilePath:] (in DevToolsCore)
3 0x0000000100153f23 -[XCCompilerSpecification computeDependenciesForFilePath:ofType:outputDirectory:inTargetBuildContext:] (in DevToolsCore)
4 0x00000001003c9447 -[XCBuildRuleDGSnapshot(DependencyGraphCreation) computeDependenciesForFilePath:ofType:forBuildFileReference:withOutputDirectory:additionalProperties :inTargetBuildContext:] (in DevToolsCore)
5 0x0000000100152987 -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) _computeDependenciesForFilePath:ofType:forBuildFileReference:usingBuildRule:inTargetBuildContext:pro cessedPaths:] (in DevToolsCore)
6 0x0000000100152348 -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForFilePath:ofType:forBuildFileReference:usingBuildRule:inTargetBuildContext:] (in DevToolsCore)
7 0x000000010014fe72 -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForBuildFileReference:inTargetBuildContext:] (in DevToolsCore)
8 0x000000010014f2eb -[XCBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForAllBuildFileReferencesInTargetBuildContext:] (in DevToolsCore)
9 0x000000010014ee76 -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForAllBuildFileReferencesInTargetBuildContext:] (in DevToolsCore)
10 0x000000010014b51d -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesInTargetBuildContext:] (in DevToolsCore)
11 0x000000010013d81f -[XCProductTypeSpecification computeDependenciesInTargetBuildContext:] (in DevToolsCore)
12 0x0000000100138a74 -[XCNativeTargetDGSnapshot(DependencyGraphCreation) computeDependenciesInTargetBuildContext:] (in DevToolsCore)
13 0x00000001001344d1 -[PBXTargetBuildContext createDependencyGraphWithTargetDGSnapshot:] (in DevToolsCore)
14 0x00000001001333d6 -[PBXTargetBuildContext(DependencyGraphEvents) dg_setTargetSnapshot:] (in DevToolsCore)
15 0x00007fff80b19d2c __invoking___ (in CoreFoundation)
16 0x00007fff80b19bfd -[NSInvocation invoke] (in CoreFoundation)
17 0x0000000100132d3f -[PBXTargetBuildContext(DependencyGraphEvents) processDependencyGraphEvents] (in DevToolsCore)
18 0x00007fff80b19d2c __invoking___ (in CoreFoundation)
19 0x00007fff80b19bfd -[NSInvocation invoke] (in CoreFoundation)
20 0x00000001001328f7 -[XCInvocationQueue _processNextInvocationInThreadSlotNumber:] (in DevToolsCore)
21 0x0000000100132626 -[XCInvocationQueue _processInvocationsInThreadSlotNumber:] (in DevToolsCore)
22 0x00007fff885eee8d __NSThread__main__ (in Foundation)
23 0x00007fff844ed456 _pthread_start (in libSystem.B.dylib)
24 0x00007fff844ed309 thread_start (in libSystem.B.dylib)

How would you describe the way to add a private framework? Why is it not working like in the tutorial?

Matthew Yohe
Jul 12, 2010, 05:38 AM
Use this instead: http://github.com/rentzsch/OAuthConsumer

Also this isn't a "private framework"

robbieduncan
Jul 12, 2010, 05:43 AM
I've had a thought: you should go and check the documentation: you cannot use your own Frameworks on the iPhone (simulator or device).

MACloop
Jul 12, 2010, 06:25 AM
I've had a thought: you should go and check the documentation: you cannot use your own Frameworks on the iPhone (simulator or device).

I know! It is a third part framework and I thought this one was ok? So this means - every developer has to write this rather un-trivial stuff for auth. self? Is that effective?

Use this instead: http://github.com/rentzsch/OAuthConsumer

Also this isn't a "private framework"

What do you mean by the framework not being a private one? Is it ok or not to use? I am a bit confused now... The code you told me to use seem to be equal to the one I hacve used. What is the difference and why should the one recommmended by you work better?

robbieduncan
Jul 12, 2010, 07:22 AM
I know! It is a third part framework and I thought this one was ok? So this means - every developer has to write this rather un-trivial stuff for auth. self? Is that effective?

What do you mean by the framework not being a private one? Is it ok or not to use? I am a bit confused now... The code you told me to use seem to be equal to the one I hacve used. What is the difference and why should the one recommmended by you work better?

A Private Framework is an Apple supplied/shipped one that is not part of the public API. You should never use these as Apple may change them at any time and will reject your app.

A Third-Party Framework is a non-Apple supplied framework that is not supplied with the OS.

Apple do not support dynamic linking for App Store app. This means you cannot include Third-Party frameworks in your app. You can statically link with third-party libraries which would enable you to link against a third-party auth library.

MACloop
Jul 12, 2010, 07:29 AM
...
Apple do not support dynamic linking for App Store app. This means you cannot include Third-Party frameworks in your app. You can statically link with third-party libraries which would enable you to link against a third-party auth library.
I do not understand wht you mean about this? May or may I not use third-part frameworks? If not, there is no use going on with my tests. The I have to write my own classes to solve this

robbieduncan
Jul 12, 2010, 07:38 AM
I do not understand wht you mean about this? May or may I not use third-part frameworks? If not, there is no use going on with my tests. The I have to write my own classes to solve this

You may not use a third-party framework but you may use a third-party, statically-linked library. A framework is not the same thing as a library. I can't really make it any simpler than that.

MACloop
Jul 12, 2010, 07:43 AM
You may not use a third-party framework but you may use a third-party, statically-linked library. A framework is not the same thing as a library. I can't really make it any simpler than that.

ok thanks
so, if the developer self call it a framework i suppose it is one.

MACloop
Jul 13, 2010, 01:52 AM
You may not use a third-party framework but you may use a third-party, statically-linked library. A framework is not the same thing as a library. I can't really make it any simpler than that.

As I have all the source code, I suppose I could use the classes as they are, in my project? The alternative about statically-linked library is perhaps a easier way to reuse code? I mean, if I integrate the code from the framework into my code, it would be rather complicated. So, is there a better way to reuse code? How do I statically-link libraries?

MACloop

robbieduncan
Jul 13, 2010, 01:57 AM
So, is there a better way to reuse code? How do I statically-link libraries?p

Have you considered Google? This took about 10 seconds to find (http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html).

MACloop
Jul 13, 2010, 02:34 AM
Have you considered Google? This took about 10 seconds to find (http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html).

yes I know that one. Was not sure though if this is what I need?