Results 1 to 15 of 15

Thread: iOS ARC (Automatic Reference Counting) Support

  1. #1
    ArturFriesen is offline Registered User
    Name: Artur Friesen
    Organization: personal
    Project: small game with push-support
    Join Date
    Jan 2012
    Posts
    12

    Question iOS ARC (Automatic Reference Counting) Support

    Hi,

    does IceTouch 1.2 support ARC?

    The generated Files are not ARC-compliant.

    Is there a way to switch off ARC for the generated files?
    The files are not listed under the compile sources. Is it possible
    to add the compiler flag (-fno-objc-arc) to the generated files?

    At the moment i switched off ARC for the whole Project.
    Which is not a good solution...

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,643
    Hi Arthur,

    We currently don't support automatic reference counting with Ice Touch. Adding this is on our TODO list however. There's no easy way to turn off ARC for generated files but I can think of 2 options to do it:
    • Create a static library project to compile the Slice files and generated code ARC turned off for the static library project.
    • Don't use the Xcode plugin to compile the Slice files but manually build the Ice files and add the generated sources to your project and turn ARC off on the generated files.


    Cheers,
    Benoit.

  3. #3
    ArturFriesen is offline Registered User
    Name: Artur Friesen
    Organization: personal
    Project: small game with push-support
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by benoit View Post
    Create a static library project to compile the Slice files and generated code ARC turned off for the static library project.
    Thanks for your response Benoit.

    Anyway the project requires a static library which handles some communication..
    At the moment im trying to integrate ICE over a static Library. But im getting the following
    Error. Can you point me in the right direction?

    Libtool DerivedData/ProjWorkspace/Build/Products/Debug-iphoneos/libPushSupport.a normal armv7
    cd /Users/Arti/Projekte/Mobile/Proj/App/Proj
    setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool -static -arch_only armv7 -syslibroot /var/folders/81/81hAzeK8HWm2hnbJ5EHUMU+++TI/-Caches-/com.apple.Xcode.501/CompositeSDKs/iphoneos-iPhoneOS5.0-djkhsmzpagbpgpacthuebkbvnnuu -L/Users/Arti/Projekte/Mobile/Proj/App/Proj/DerivedData/ProjWorkspace/Build/Products/Debug-iphoneos -filelist /Users/Arti/Projekte/Mobile/Proj/App/Proj/DerivedData/ProjWorkspace/Build/Intermediates/PushSupport.build/Debug-iphoneos/PushSupport.build/Objects-normal/armv7/PushSupport.LinkFileList -ObjC -all_load -lstdc++ -lIceObjC -framework ExternalAccessory -framework Foundation -framework Security -framework CFNetwork -o /Users/Arti/Projekte/Mobile/Proj/App/Proj/DerivedData/ProjWorkspace/Build/Products/Debug-iphoneos/libPushSupport.a

    Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool failed with exit code 1

  4. #4
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    823
    Hi Artur,

    The problem is that Ice Touch Xcode plug-in currently do not support build static libraries, you need to manually configure the project.

    To disable the plug-in don't add IceTouch to ADDITIONAL_SDKS, you will need to add /Developer/SDKs/IceTouch-1.2/$(PLATFORM_NAME)/usr/local/include to the project include directories, and you will also need to run slice2objc and add the generated files to your project. Probably you can run slice2objc from a custom build step in Xcode or you can do it manually.

  5. #5
    ArturFriesen is offline Registered User
    Name: Artur Friesen
    Organization: personal
    Project: small game with push-support
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by xdm View Post
    Hi Artur,

    The problem is that Ice Touch Xcode plug-in currently do not support build static libraries, you need to manually configure the project.

    To disable the plug-in don't add IceTouch to ADDITIONAL_SDKS, you will need to add /Developer/SDKs/IceTouch-1.2/$(PLATFORM_NAME)/usr/local/include to the project include directories, and you will also need to run slice2objc and add the generated files to your project. Probably you can run slice2objc from a custom build step in Xcode or you can do it manually.
    I removed the ADDITIONAL_SDKS and generated and added the files with slice2objc.

    But where i have to add the path to the ICE-implementation?

    I tried it in "Framework Search Paths" , "Header Search Paths" , "User Header Search Paths"
    but still got Error with #import <Ice/Ice.h>

  6. #6
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    823
    You should use "Header Search Path" note is a missing .sdk in the path of my previous post, it should be:

    Code:
    /Developer/SDKs/IceTouch-1.2/$(PLATFORM_NAME).sdk/usr/local/include
    Note the .sdk after $(PLATFORM_NAME)

  7. #7
    ArturFriesen is offline Registered User
    Name: Artur Friesen
    Organization: personal
    Project: small game with push-support
    Join Date
    Jan 2012
    Posts
    12
    Added the path with .sdk to Header Search Path,
    but still cant #import <Ice/Ice.h>

    Its strange because the error appears only if i try to import the main-header from the static library to my implementation.
    If i remove the static library import. The static library project with ICE builds without errors.

  8. #8
    ArturFriesen is offline Registered User
    Name: Artur Friesen
    Organization: personal
    Project: small game with push-support
    Join Date
    Jan 2012
    Posts
    12
    I moved the imports:

    #import <Ice/Ice.h>
    #import <Slice.h>

    to the .m implementation file of my static library.

    Now at least it compiles

  9. #9
    ArturFriesen is offline Registered User
    Name: Artur Friesen
    Organization: personal
    Project: small game with push-support
    Join Date
    Jan 2012
    Posts
    12
    I cheered too soon!

    If i try to instantiate my static library object i get the following linker errors:

    Undefined symbols for architecture armv7:
    "_OBJC_EHTYPE_$_ICEUserException", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEUtil", referenced from:
    xxx
    "_OBJC_METACLASS_$_ICEObject", referenced from:
    xxx
    "_ICEInternalLookupString", referenced from:
    xxx
    "_OBJC_METACLASS_$_ICEObjectPrx", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEOperationNotExistException", referenced from:
    xxx
    "_OBJC_EHTYPE_$_ICEException", referenced from:
    xxx
    "_ICEInternalCheckModeAndSelector", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEUnknownUserException", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEObject", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEObjectPrx", referenced from:
    xxx
    ld: symbol(s) not found for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

  10. #10
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    823
    Hi Artur,

    Not sure i understand what you are doing.

    You get this problem when you include the main header of the static library project in your application. If that is the case:

    You need to configure your application to use the Ice Touch plug-in, as you need to link with Ice Touch libs not just with your static libraries. The plug-in will also take care to configure the Header Search Path.

    When you add the includes in your .m that is private for the library implementation so the applications don't see it, but you still need the plug-in so your application is linked with Ice Touch libraries.

    The linker errors are because you don't link with Ice Touch libraries, add the plug-in setting ADDITIONAL_SDKS and all should work

  11. #11
    ArturFriesen is offline Registered User
    Name: Artur Friesen
    Organization: personal
    Project: small game with push-support
    Join Date
    Jan 2012
    Posts
    12
    hi xdm,

    thanks for your fast reply!

    The project Im working on, uses ARC and i have a strict requirement to include ICE over a static library.

    The good thing is, that the problem with ARC would be solved if i use a static library. Because i can turn off ARC for this library and still use it in the main-project.

    But now i have this trouble with the static library.

    Is there an example implementation with a static library?

  12. #12
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    823
    Hi Artur,

    I'm afraid there isn't a demo to use Ice Touch with a static library project.

    You should try this:

    You build the generated files in a static library project with ARC disabled

    In you application with ARC enabled, you link with your static library and with Ice Touch library.

    To link with Ice Touch library the easy is to enable the plug-in, but don't add Slice files in your application project, slice files should go in your static library.

    The problem with ARC is that slice2objc generated code is not compatible with ARC, but if the generated code is in your static library where ARC is disabled there shouldn't be problems. Note that Ice Touch is just a static library compiled without ARC.

  13. #13
    ArturFriesen is offline Registered User
    Name: Artur Friesen
    Organization: personal
    Project: small game with push-support
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by xdm View Post
    Hi Artur,

    I'm afraid there isn't a demo to use Ice Touch with a static library project.

    You should try this:

    You build the generated files in a static library project with ARC disabled

    In you application with ARC enabled, you link with your static library and with Ice Touch library.

    To link with Ice Touch library the easy is to enable the plug-in, but don't add Slice files in your application project, slice files should go in your static library.

    The problem with ARC is that slice2objc generated code is not compatible with ARC, but if the generated code is in your static library where ARC is disabled there shouldn't be problems. Note that Ice Touch is just a static library compiled without ARC.
    If I understand you right, then "enable the plug-in" means that I add "/Developer/SDKs/IceTouch-1.2/$(PLATFORM_NAME).sdk" to Additional SDKs in my Target-Build-Settings. Add the right .frameworks. Add "$(SDKROOT)/ResourceRules.plist" to Code Signing Resource Rules Path.

    I did that and still the following errors:

    Undefined symbols for architecture armv7:
    "_OBJC_EHTYPE_$_ICEUserException", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEUtil", referenced from:
    xxx
    "_OBJC_METACLASS_$_ICEObject", referenced from:
    xxx
    "_ICEInternalLookupString", referenced from:
    xxx
    "_OBJC_METACLASS_$_ICEObjectPrx", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEOperationNotExistException", referenced from:
    xxx
    "_OBJC_EHTYPE_$_ICEException", referenced from:
    xxx
    "_ICEInternalCheckModeAndSelector", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEUnknownUserException", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEObject", referenced from:
    xxx
    "_OBJC_CLASS_$_ICEObjectPrx", referenced from:
    xxx
    ld: symbol(s) not found for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)


    To make the situation a little bit clearer. I try to describe my setup:

    Im using XCode4. I have a workspace. Within this workspace there ist the main-project and another project as a static library. I just want to add the ICE-implementation to the static library project. And then use this static library in my main-project to do some communication. I did the workspace setup like described in this blog: Using Open Source Static Libraries in Xcode 4 | The Carbon Emitter

    I tried all kind of combinations and im fighting with this since 5 days. I tried to use the plugin in both, the main-project and the static library. I also tried to include "/Developer/SDKs/IceTouch-1.2/$(PLATFORM_NAME).sdk/usr/local/include" in different places. Nothing works.

  14. #14
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    823
    Hi Artur,

    I think the problem is that IceTouch XCode plug-in don't work well with workspaces, we have not tested it before, but when tested i found that this don't work well.

    To workaround the problem i see two options:

    Create a single project where you manually add generated files and turn off ARC for the generated files, don't add Slice files to the project, you can enable the plug-in to automatically link with IceTouch SDKs.

    Or create two separate projects, the lib project with no ARC, no IceTouch plug-in, and Slice files that you need to compile manually, and Header Search Path configured. And the application project with must enable the plug-in to link with IceTouch libraries, and add also your library to "Linked Frameworks and Libraries"

    Also note that your ARC enabled sources cannot direct or indirectly include Ice headers, or you will get errors similar to:
    Code:
    /var/folders/0x/16rd6qxx33nct7h8qsw7rm780000gn/C/com.apple.Xcode.501/CompositeSDKs/iphonesimulator-iPhoneSimulator5.0-bsphxshsjdajccawfivcxwmfzbyb/usr/local/include/Ice/Object.h:24:39:{24:29-24:41}:
    error: must explicitly describe intended ownership of an object array
    parameter [4]
     int ICEInternalLookupString(NSString *[], size_t, NSString *);
                                 ~~~~~~~~~~^~
    1 error generated.
    Maybe is just easy to not use ARC and wait until IceTouch include support for it to switch to ARC.

  15. #15
    rl1
    rl1 is offline Registered User
    Name: Rene Limberger
    Organization: Rene Limberger
    Project: iOS
    Join Date
    Jun 2012
    Posts
    4
    Hi,

    what is the ETA for ARC support in IceTouch? I have a ARC project that i want to add Ice support to.

    Thanks so much,
    -r

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. IceTouch with Automatic Reference Counting Enabled
    By gorilla234 in forum Help Center
    Replies: 0
    Last Post: 01-12-2012, 08:31 PM
  2. Updating iOS SDK, compilation, linking
    By Janggwan in forum Help Center
    Replies: 3
    Last Post: 07-08-2011, 08:26 AM
  3. Additional Steps for IceTouch set up on iOS 4?
    By duckjones in forum Help Center
    Replies: 3
    Last Post: 12-09-2010, 01:47 AM
  4. Who's Counting? Sample code errors?
    By blair in forum Comments
    Replies: 2
    Last Post: 07-25-2007, 06:45 PM
  5. Application Shutdown & Ref Counting Classes
    By acbell in forum Help Center
    Replies: 3
    Last Post: 12-05-2006, 01:01 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •