ZipKit and iPhone - iphone

I tried to use the ZipKit framework (http://bitbucket.org/kolpanic/zipkit/wiki/UsingZipKit) in the test application for iPad. I followed the "Traditional way" of the installation (as it is described on their page) with no success. Hope somebody can help me with it:
1/ I used hg to get sources
2/ I build the ZipKit project (Release build)
3/ After doing this there was created in the build folder the new ZipKit.framework folder
4/ I have created a new test project for the iPad 3.2 (XCode 3.2.4)
5/ I have drag&dropped the ZipKit.framework folder created in the step 3) into Frameworks section on my new test project
6/ In Targets section I have created new Copy File Build Phase and I drag&drop the ZipKit.Framework from Frameworks section to the new Copy Files folder.
7/ Then I build and run the project.
The project cannot be even started, it is being closed after I press the project icon - so I must do something terribly wrong. In the console output I can see the error - it is pretty clear what is missing, but I do not know what to do with that... Might be some XCode expert or someone, who used the ZipKit can help me - this must some really stupid mistake I am doing...
There is the console output:
dyld: Library not loaded: #rpath/Frameworks/ZipKit.framework/Versions/A/ZipKit
Referenced from: /Users/sten/Library/Application Support/iPhone Simulator/3.2/Applications/3C51FC4F-0E85-48D2-BC68-D01ADD73DAE1/ZipExample.app/ZipExample
Reason: image not found
Failed to launch simulated application: iPhone Simulator failed to find the process ID of com.yourcompany.ZipExample.
BTW - I have tried to run the ZipKit Touch example provided with the framework and it works perfectly...
Thanks a lot
BR
STeN
There is the screenshot of my test project - on the left side you can see the ZipKit.framework I drag&drop into my project:

Is there a basic page which shows some simple code for inflating and deflating files and directories for ZipKit?
UPDATE:
I figured this out but it was a scavenger hunt:
NSString *filePath = [userDocumentsDirectory stringByAppendingPathComponent:#"newFile.zip"];
ZKFileArchive *archive = [ZKFileArchive archiveWithArchivePath:filePath];
[archive deflateDirectory:exportDirectory relativeToPath:nil usingResourceFork:NO];

You should go back and read it again.
The "traditional way" is not the right way to do this - Apple don't allow iOS applications with external frameworks like this - you want to link against the static library instead using the process described under "Static Library Target".

I've updated the Using ZipKit page to make it clear which ZipKit target should be used for what type of product.

Related

How to link custom framework within UITest target in Xcode - another "Library not loaded - #rpath"-issue

My project uses Xcode 11.3.1 and is structured as followed:
MyProject
- MyProject.xcworkscapce
- MyFramework
- MyApp
-MyApp (main-target)
-MyAppUITests (uiTest-target)
MyApp imports MyFramework and can be built und run just fine. For this to work I added MyFramework to main-target into main-targets General/Frameworks and Libraries.
In my UITest target I need to access some classes (Accessibility-Identifier-Definitions) from MyFramework, so I need to import these somehow.
Both targets are building and the main-target works without any issues. I am also able to run ui-tests on a simulator. Unfortunately I am forced to run my tests on real devices, and here I get this runtime error:
The bundle “MyAppUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
(dlopen_preflight(/var/containers/Bundle/Application/E581B3BA-A9A2-4AA3-A1BA-91C57DCD3846/MyAppUITests-Runner.app/PlugIns/MyAppUITests.xctest/FHCommunityUITests): Library not loaded: #rpath/MyFramework.framework/MyFramework
Referenced from: /var/containers/Bundle/Application/E581B3BA-A9A2-4AA3-A1BA-91C57DCD3846/MyAppUITests-Runner.app/PlugIns/MyAppUITests.xctest/MyAppUITests
Reason: image not found)
I am fairly new to this framework-thing (and also to ui-tests) and it's been two days I am dealing with this issue now. Most posts about similar issues are related to misspecified Podfiles, but in my barebone sample project which I setup to not destroy my real project I am not using any Pods. I tried probably all of the suggested solutions (and almost all combinations :() and none of them seem to work.
It took me a while to figure out that in my uiTest-target build phases I can actually add a New Run Script Phase and I assume I need to somehow link MyFramework here.
Is this correct? Can someone help me defining the run script?
And yes, I tried to clean my app (and I also deleted derived data).
Help is highly appreciated. Thank you!
Ok, finally I figured it out. The solution is fairly simple and I haven't seen anyone suggesting this. Here we go:
To use your custom framework in your app target simply add it under Frameworks, Libraries, and Embedded Content:
Now you can access MyFramework from the main target.
I could also run my ui-tests from the simulator, but still got the error described above when executing my ui-tests from my real devices.
To get rid of the The bundle “xxxUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.-Error I had to go to my uiTest-target and link the framework in my build phases.
As Destination choose Frameworks and select the Framework you want to use in your uiTest-target.
Now you should be able to run your ui-Test from your device.

core plot 1.0 with iPhone 5 and Xcode 4.2 - 'CorePlot0' does not contain a valid pid Error on compilation

I have followed installation steps from the core plot in Application url.
As defined in subject, core plot version is 1.0 which was tried with iPhone 5.0 Simulator in Xcode 4.2.
what I did :
1) I've simply copy one of the CorePlot Example (i.e : CPTTestApp-iphone) from CorePlot_1.0/Source/Example Folder to my Xcode project workspace.
2) Drag&Drop framework folder from CorePlot_1.0/Source/ in my example app.
3) Changed Header Search Path and User Header Search Path with string
"${PROJECT_DIR}/framework"/**
4) and follows other steps as from the core plot in Application url
like set other linker flags, added core plot and core plot cocoaTouch in target Dependencies and Link Binary With Libraries section.
5) Compiler for C in "Build Option" is "default compiler (Apple LLVM compiler 3.0)",
"CorePlot-CocoaTouch.h" file is also imported without error.
But on compilation time, application crashed with error "'CorePlot0' does not contain a valid pid" which is from "checkformisalignedlayers.d" file.
Note : the same example is working perfectly when executed from CorePlot_1.0/Source/examples folder.
does any steps are missing or anything wrong with the installation steps ?
Thanks in advance.
Problem solved.CorePlot installation is working perfectly now.
as per existing example.header path details is set with framework path.and I've added framework directory in application.
but instead of adding framework directory in application only need to add CorePlotHeaders directory.
hope, answer could help to others.
I was also getting the similar error but on adding only the CorePlotHeaders folder to my xcode project solved the problem. Earlier I had the entire framework which I had downloaded in the project and it gave me that error.
Now it works!
'CorePlot0' does not contain a valid pid
Caused when we validated project and changed from GCC to LLVM
Removed checkformisalignedlayers.d reference from project.
Built ok. Not sure how it affects charts.

ZipKit and Xcode 4

We're trying to set up ZipKit as part of our Xcode 4 project using these instructions and we're having trouble getting our application to compile.
Here's the setup we currently have (as I'm not allowed to post images, I'll just give you the links to them):
Project Setup
All builds are set to go into a shared directory:
Xcode Preferences.
When building the app, we get the following error:
UIUpdateDownloadDialog.m:10:9: fatal error: 'ZKDataArchive.h' file not found 1
That line in UIUpdateDownloadDialog.m says #import "ZKDataArchive.h".
Any ideas on what we're doing wrong?
Thank you!
I'm sorry it took so long to respond, but my schedule has been very hectic.
We managed to get ZipKit working under XCode 4 and be able to build for both the simulator and devices.
Here's how we did it:
We opened the Demo project from ZipKit and went all the way down to find the included ZipKit.xcodeproj.
Once we had that, we opened our project and [dragged ZipKit into the frameworks folder of our project. http://i.stack.imgur.com/zcbYR.png
We changed the build settings of both the targets in our project (as well as the static library touchzipkit) to Build Active Architecture Only.
We were then able to build everywhere.
In fact, last night we were about to send the app update to Apple, but when trying to create the archive we got a linking error! But that's a question on its own.
Thank you all for trying to help!
It looks like there is a ZipKit framework - try adding that to your project instead of the whole project and importing like so:
#import <ZipKit/ZipKit.h>
The other alternative is to try adding the Zipkit directory to the include path, though having ZipKit as sub-project should include all the classes and header files.

Can't compile Three20 template on iOS4

I pulled the latest version of three20 from github and installed their template. I opened it up in XCode, built it, ran it, then I realized the template isn't iOS4 ready.
The first issue I found was "Base SDK not found". I solved it in Edit Project Setting by changing the Base SDK to "iOS Device 4.1".
Then I ran it again. I got tons of errors related to "Three20/Three.h: No such file or directory". I added the "../three20/src" to my Header Search Paths but it doesn't help.
Does anyone know why? What else should I change?
FYI:
XCode Version 3.2.4
Latest version of three20 (29 September)
Directories:
xcode/myproject/
xcode/three20/
PS: the template works fine in SDK 3.0
I was pulling my hair out as well since adding three20 correctly to your new iOS4 with really basic instructions listed here: http://github.com/facebook/three20 did not work as well.
Issue: Can compile newly three20 to your iOS project and got this error: Can't find #import "Three20/Three20.h".
Here is the best solution for those have the same issue:
1) Add your three20 to your iphone project path like this:
[yourProjectPath]/[iOSProjectName]/three20/..
2) cd three20 dir
3) run:
python src/scripts/ttmodule.py -p [yourProjectPath]/[iOSProjectName]/[iOSProjectName].xcodeproj Three20 -c Debug -c Release
4) go to XCode and do a build now.
Thanks to jverkoey for adding this in ...man
u save us a lot of headache if u ever read this :- ) kudos bud! :- )
http://github.com/facebook/three20/commit/0814b1c149cbe987557c88a271f999c3f9f3ae64
Please vote this answers if it help u. Thanks :-)
Turn out I have to use http://github.com/ECP/three20 instead .
An answer I got from twitter - "need to manually set build target of each projects"
He might be right.
My solution was to add the following to the Header Search Path in Xcode:
three20/Build/Products/three20
Xcode 4 screen shot:
Yours may be different of course, but maybe this will help someone.
Also, try checking the Deployment Target under Project Settings, for both, Simulator and Device. In my case, I got thousands of errors because the target was set to 2.2. It seems there is no support for 2.2 anymore in iOS 4.1 and Xcode 3.2.4.

Upgrade to iPhone SDK 3.0 Causing UIKit Problems

I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of them, but I haven't had any luck on what I hope to be the last of my problems.
When running my program in the simulator, I now get
dyld: Library not loaded:
/System/Library/Frameworks/UIKit.framework/UIKit
Referenced from:
/Developer/iGameLib/iGameLib/build/Debug-iphonesimulator/iGameLib.app/iGameLib Reason: image not found
Now, I discovered the UIKit has moved to
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0sdk/
System/Library/FrameWorks/UIKit
and I have updated my target and project settings to point to that new framework location, but still when I build it, no luck.
I have also tried clearing out the simulator's applications and settings, still no luck.
The referencing .app is cleared when I run the "clean" menuitem, I have confirmed this, so clearly something in my project settings are still pointing to use the old UIKit location.
Where should I be looking?
I've gone as far as I can to help myself but I'm afraid I'm at a loss here. I don't see it under the target settings, or the project settings, or the plist, or any of the other files within my project.
I was getting the same error
dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit
The solution on my case was simply quit Xcode and try again.
OK, SO I HAVE THE ANSWER!!!
Quite simply, Xcode is not changing all of the variables correctly in the actual .xcodeproj file. So, here are the steps I took.
Get out of Xcode, you've got to do this job at the terminal. Bring up a terminal and go to where your project is. Find your .xcodeproj and go into it as if it were a directory. It looks like an actual file in finder, but it is one of those package directories.
Now, I couldn't get textedit to allow me to edit it, but you can go into nano, so like I did
sudo nano project.pbxproj which is under my .xcodeproj file/folder/package/whatever.
In this file, you need to find where the SDKROOT is set. Chances are there are a few places it is referenced, but you're looking for SDKROOT = iphoneos2.2.1 or something similar. Change ALL OF THESE (there are a few) to SDKROOT = iphoneos3.0
Now, you're half way there. do ctrl x and save the file. Next you're going to do ls and find out what the .pbxuser file is. Mine is myname.pbxuser. run the same command of
sudo nano myname.pbxuser
In this file, there are a HUGE number of references to the 2.1 iphone sdk directory. Do a search/replace of iPhoneSimulatorOLDVERSION.sdk, in my case it was iPhoneSimulator2.1.sdk
and change the 2.1 to 3.0. Be very careful with this though, I wouldn't want to know what happens when you mess this file up.
Save it and open xcode. CLEAN the project and build and run. Presto!
Check your target settings
Make sure you're actually linking to all of those frameworks in the Target (check under "link binary with libraries")
Make sure you've chosen the 3.0 sdk as your base SDK
Create a blank project and add your frameworks as before; if you still have issues, probably a borked SDK install
BTW, you shouldn't have to re-add sdk frameworks, as the paths are relative to the current SDK
Just trying to be helpful… not sure I can debug from here :)
I have had some similar problems with Xcode that seem to have no apparent cause. The fact of the matter is that Xcode does still have bugs here and there and sometimes you WILL run into a wall.
My Experience: Similar to your situation somewhat, on one particular occasion, an Xcode project I was working just stopped building for whatever mysterious reason, and no amount of cleaning, googling or SO-ing provided me any answers. So I simply created a FRESH, NEW project and filled the source-code from my corrupt project into that of the new project. The new project used the SAME source, libraries, resources, settings, mind you -- and yet it built with no problems. It took about 20-25 minutes to make the transfer but considering that I had spent several HOURS trying to address a bug that would not reveal itself in the corrupt project, the time was well worth it.
So, I'd suggest doing what I did: Maybe try creating a fresh project and transfer your old source and resources over.
Good Luck
I just deleted the UIKit.framework from the 'Frameworks' folder, right-clicked and added it back again.
Clean build, and no problem..
I had the same problem using Xcode 3.2.1 but it was solved in an easier manner. I realized I had recently disabled my target's environment variables, specifically ones to do with memory debugging (NSDebugEnabled, NSZombieEnabled, NSAutoreleaseFreedObjectCheckEnabled, MallocStackLogging, MallocStackLoggingNoCompact). The app ran once in the simulator after removing the environment variables but never again after that.
Quitting Xcode, the Simulator, restarting Xcode and doing a complete clean of the target (including it's dependencies off course) brought me back to a good state.
Same problem when launching my application without debugging.
In my experience the produced binary does not seem to be the culprit.
I created an app from the xcode wizard which does launch OK in the simulator (let's call it testApp, my application being called myApp), I tried to figure out where is the difference with my app.
otool -L myApp
gives correct (relative paths) to the frameworks, same as testApp
ps -E
DYLD_ROOT_PATH, DYLD_FALLBACK_FRAMEWORK_PATH, DYLD_FRAMEWORK_PATH, DYLD_LIBRARY_PATH environment variables needed by ld to locate the framework
are OK for myApp compared to the values of these variables when testApp is launched
I suspect that the problem lies somewhere in the communicartion between XCode and the simulator once the app is launched ... altough I can't find what's wrong ...
The solution that worked (at least for me) have certainly some big side effects but here it is :
quit xcode
browse the content of the package myApp.xcodeproj
unlock .model1v3 and .pbxuser for modification (the lock in the information panel (cmd-I on the file))
delete these two files
start xcode and retry to launch your application from there