How can I work with code completion in Xcode 4? - objective-c

How can I work with code completion in Xcode 4 when I create a new project using a Template and have a static library.
I created a new template that uses static library but when I create a new project the code completion doesn't work for static library. I can build and run the new project well and use code completion for the clases inside the project.
Thanking you in advance.

This could be caused by a known bug with Xcode's code completion. Any files that lie outside the project's root directory will not be indexed properly which means code completion and refactoring operations for any symbols defined in those files will not work.
I have filed a bug for this previously and it has been confirmed by Apple (original bug ID: 9260761).
The work around is to make sure the header files lie inside your project directory somewhere and that they have been added to your Xcode project.

You should add static library headers to your project as well. That's how Xcode knows what classes/methods to autocomplete.

Related

Problems creating a NativeScript plugin that uses Objective-C code

I have followed the NativeScript documentation on adding Objective-C code to a NS project although I am struggling to call the Objective-C code in my iOS project. I am only trying to implement appPlugin.h and appPlugin.m files into my project.
My folder structure for the Objective-C files are as follows:
Project/app/App_Resources/iOS/src/...
I have also tried creating a NativeScript plugin that gets added to the dependencies in the projects package.json.
Are there any additional files that need to be added to make the Objective-C code compatible with the NS project. The documentation simply says run "If you run 'tns prepare ios' you will see that the files are now part of the project."
Link to the documentation I have been following:
https://www.nativescript.org/blog/adding-objective-c-code-to-a-nativescript-app
https://docs.nativescript.org/plugins/building-plugins
SOLVED: Files are added to the TNSNativeSource folder (Check in Xcode) and are available to use like any JS object.

Problems archiving project with react-native-fbsdk

I have managed to get react-native-fbsdk (core, login and share) all working in my project. I can build to devices without issue but if I try to create an archive from Xcode I get the error
Lexical or Preprocessor Issue
'RCTBridgeModule.h' file not found
I have followed the install instructions and create a virgin project and done it again to ensure nothing else could be causing this.
Similar Xcode related questions have come up blank for me too:
Xcode 4 can't locate public header files from static library dependency
When archiving app Xcode complains about missing files
Xcode 4 and nested projects -- header files not found
This makes me wonder if there's something else to to with FBSDK specifically that I need to do to get it to archive properly.
Has anyone got a project to archive with react-native-fbsdk? If so, how?
Note: I skipped the step regarding explicitly naming the path for static libraries as I do not know what the name should be; I do not know which the static library would be fbsdkcore (etc) or react-native/react.
I appears that the repo had an error in its header search paths in 'release' distribution. The fix was to correct the xcodeproj in the plugin (A PR is currently going through for this) as outlined here
The following line is present in the debug distribution but not in release for any of the required xcodeproj's
"$(SRCROOT)/../../node_modules/react-native/React/**",
Adding this fixes the error.
Full Source Code Alterations

Extending Titanium WebViewProxy for Android - Build error

I need to extend Titanium's Android Webview with some additional functionality, however I'm not able to build my titanium project after including my created module.
My module has the titanium-ui.jar on it's build path and I have copied the original Titanium WebViewProxy.java into my module project. I haven't added any custom code to WebViewProxy.java yet.
This is the project hierarchy of my module, together with the build.properties file.
When building the module, I get an exception but the module seems to get built anyway, this must have something to do with the final problem. When I remove the WebViewProxy.java and keep the titanium-ui.jar on my build path, building the module and including it in my titanium project works fine.
Here's the full console log of the build script of the module: http://pastebin.com/G2LSkFLF
This is what happens when I try to run my titanium project using the generated module (the one, that threw the exception while building)
Does anyone know how to solve this? Maybe some different approach at all? I have some special url schemes in my app and I need to handle them. I have already a similar module for iOS, which works fine.
Thanks.
Ok, I finally found the solution. It was so easy... The WebViewProxy.java had to be adjusted a little bit.
#Kroll.proxy(creatableInModule=UIModule.class, propertyAccessors = {
has to be
#Kroll.proxy(creatableInModule=CustomwebviewModule.class, propertyAccessors = {
UIModule.class has to be replaced with the class name of your Module.

Unable to set up rhino debugger as a project in my IDE

I am trying to tweak Rhino debugger work with my servlet so I downloaded the sources and for some reason I having some difficulties to set up the project properly in my IDE (intellij).
I have tried to add both the SRC and the Jar file but it seem like there is an .internal. package that get in the way.
For example:
Global that somewhere along the inheritance chain extends from sun.org.mozilla.javascript.internal.ScriptableObject
But who ever is using Global is expecting org.mozilla.javascript.ScriptableObject.
When I build the code using ant, it works fine so I am guessing it is something that I am missing..
Any ideas?
The issue was that IntelliJ was modifying the imports when loading the project.
and the imports got mixed up between the
org.mozilla.javascript...
and sun.org.mozilla.javascript.internal.ScriptableObject
Creating a new project with the whole downloaded zip fixed the problem and gave the right source the was loaded

Hide code in static library (iOS Obj-C)

I'm working to create an iOS static library that I wish to sell. I've walked through the steps for the initial builds and have generated the .a/.h output.
When I include these files in a separate project, I don't see any way to browse the contents on the .a file.
HOWEVER, when a line of code in my library crashes the app (like I said, it's still in development), the debugger shows the entire class (.m) file to me. What's up with this?
I don't really understand what all goes into static libraries, and I'm not sure I compiled that version for both simulator and device. Could that have something to do with it? If so, could someone explain why?
Thanks!!!
Don't worry, your source code is not included in the archive (.a) file.
Xcode is smart enough to find the source code file on your computer, based on the debugging information embedded in the file. If you build the library using the "Release" configuration (or otherwise modify the build settings so that debugging symbols are stripped) and don't have the source anywhere on the machine, a developer will have to resort to their knowledge of x86 or ARM assembly to figure out how your code works.
By the way:
Since a lot of Objective-C is handled at runtime, a lot of class names and selector names will be visible in your library. That's just how it works. You could try to obfuscate it, but I think your time is better spent writing more useful code to sell.
If you want to give people a static library for iOS development, you'll want to build versions for the iOS Simulator (x86) and the iOS Device (arm) and then use lipo to combine them into a single fat static library. Search around for "lipo xcode fat static library" for different ways to do this. Some solutions are more convoluted than others.
I had the same issue. #benzado is right about what he has mentioned. But I had to strip debugging symbols to solve the issue. To do so, I had to change Build Settings of project library before build as mentioned below.
Select your Target and go to Build Settings. Set
' Strip Debug Symbols During Copy ' to YES
' Debug Information Format ' to 'DWARF with dSYM File'
' Generate Debug Symbols ' to 'NO'
' Symbols Hidden by Default ' to 'YES'
To see what are these for, refer Apple Build Setting Reference
And build the library using the "Release" configuration. This worked for me.
If you have a project for static library with all .m files on your computer then every copy of this library (.a file) will be symbolicated with its .m file while debugging in xCode.
xCode doesn't search for appropriate .m file through all your disk. It knows the place of original project. So if you distribute only library it fully hides your initial code.
To make sure you can copy your library in some new project then clear .m file in library project.
From this moment any attempt to debug methods of library will give empty file on screen.