Property semantics - private vs public APIs

Hi,
Question about property directives and how to enable separate public and private semantics.
In my class's public interface I would like a property to be read only so I declare it as follows:
@property (readonly) someproperty;
However, within the class I would like to set the property and have the convenience of retain being called and set to nil through the property so the release happens. So I would do the following:
@property (retain) someproperty;
Now the two semantics are not entirely mutually exclusive. I could do the following:
@property (readonly , retain) someproperty;
However, external users of the class can use the setter which is not what is intended. Coming from a Java and C# background it seems that objecive-c does not provide as robust a syntax for making clean distinctions between public and private interfaces.
What strategies can you suggest to achieve my goals of keeping my private and public semantics and usage clear? Any good web resources on the broader subject of best practices in API design in objective-c?

Yes class-dump can always be used to generate public interfaces in a hostile world but that's not really the point. The issue is how to generate clean interfaces for a team of software developers. Anyway after talking to Matt, I have answered my own question: a synthetic property, a category plus a hand coded setter will make this work. Once the bug in @synthesize is fixed this will be nice solution to the problem.
Here are a few bits to illustrate:
In MyClass.h
@interface MyClass
@property (readonly) id someProperty;
@end
In MyClass.m
#import "MyClass.h"
@interface MyClass (Private)
@property (retain) id someProperty;
@end
@implementation MyClass
@synthesize someProperty;
// Bug - hand written setter needed since @synthesize will not generate one for me
- (void) setSomeProperty: (id)newProperty
if (newProperty != someProperty)
[someProperty release];
someProperty = [newProperty retain];
@end
Files that import MyClass.h will only have access to the getter while the setter is available to MyClass.m.

Similar Messages

  • Public APIs vs Private APIs

    Hi All,
    Am a beginner in Apps want to know whts the difference between Public APIs and Private APIs
    rgds

    Yes class-dump can always be used to generate public interfaces in a hostile world but that's not really the point. The issue is how to generate clean interfaces for a team of software developers. Anyway after talking to Matt, I have answered my own question: a synthetic property, a category plus a hand coded setter will make this work. Once the bug in @synthesize is fixed this will be nice solution to the problem.
    Here are a few bits to illustrate:
    In MyClass.h
    @interface MyClass
    @property (readonly) id someProperty;
    @end
    In MyClass.m
    #import "MyClass.h"
    @interface MyClass (Private)
    @property (retain) id someProperty;
    @end
    @implementation MyClass
    @synthesize someProperty;
    // Bug - hand written setter needed since @synthesize will not generate one for me
    - (void) setSomeProperty: (id)newProperty
    if (newProperty != someProperty)
    [someProperty release];
    someProperty = [newProperty retain];
    @end
    Files that import MyClass.h will only have access to the getter while the setter is available to MyClass.m.

  • What is the difference between private API and public API??

    Hi,
    I came accross the terms private API and Public API ?
    what are these APIs and what is the difference between them??
    Thanks and Regards,
    Soham

    Soham,
    Publicly Callable Business Process APIs are the list of supported and published APIs. Direct calls to any other routines are not supported, unless explicitly specified, because API validation and logic steps will be bypassed. Many other packages include procedures and functions, which may be called from the API code itself.
    Note:216838.1 - Oracle HRMS Product Family Publicly Callable Business Process APIs (A Reference Consolidation)
    Regards,
    Greg

  • Private API and Public API

    What is the difference between private API and public API??

    Hello,
    from a technical point of view, a private API is normally embedded in a public API.
    The NON ORACLE specialist developpers have to use public API as an interface to control ORACLE APPLICATIONS.
    Normally, the functions/procedures of private API must be hidden to the NON ORACLE specialist developper.
    Roméo.

  • App rejected due to non-public api's

    Hi,
              My App rejected due to non-public api's.
    Apple's Comments: 
    2.5: Apps that use non-public
                                      "We found that your app uses one or more non-public APIs, which is not in compliance with the App Store Review Guidelines. The use of non-public APIs is not permissible because it can lead to a poor user experience should these APIs change.
    We found the following non-public API/s in your app:
    _updateView (I have the method name like "_updateView" in my source, can I change the name of the method. Is it works ? )
    If you have defined methods in your source code with the same names as the above-mentioned APIs, we suggest altering your method names so that they no longer collide with Apple's private APIs to avoid your application being flagged in future submissions.
    Additionally, one or more of the above-mentioned APIs may reside in a static library included with your application. If you do not have access to the library's source, you may be able to search the compiled binary using "strings" or "otool" command line tools. The "strings" tool can output a list of the methods that the library calls and "otool -ov" will output the Objective-C class structures and their defined methods. These techniques can help you narrow down where the problematic code resides."
                                    And in my application, I am using the FBConnect, SDWebImage library,  and Twitter+oAuth api's. These are non-public api's ? Now, can I integrate Jira (Crash Reporter) to my application? Can anybody solve my issue......
    Thanks & Regards,
    Rajesh Kumar Yandamuri

    I have the same problem what to do with below points from the apple.
    Requires help plz help me my app rejected two times with this points.
    We found that your app uses one or more non-public APIs, which is not in compliance with the App Store Review Guidelines. The use of non-public APIs is not permissible because it can lead to a poor user experience should these APIs change.
    We found the following non-public API/s in your app:
    _tearDown
    If you have defined methods in your source code with the same names as the above-mentioned APIs, we suggest altering your method names so that they no longer collide with Apple's private APIs to avoid your application being flagged in future submissions.
    Additionally, one or more of the above-mentioned APIs may reside in a static library included with your application. If you do not have access to the library's source, you may be able to search the compiled binary using "strings" or "otool" command line tools. The "strings" tool can output a list of the methods that the library calls and "otool -ov" will output the Objective-C class structures and their defined methods. These techniques can help you narrow down where the problematic code resides.
    We appreciate that you may have made the precautions in your code for using non-public APIs, however, there is no way to accurately or completely predict how an API may be modified and what effects those modifications may have. For this reason, we do not permit the use of non-public APIs in App Store apps.
    If there are no alternatives for providing the functionality your app requires, we encourage you to file an enhancement request. Or, try working with the Apple Developer Technical Support team to explore alternative solutions. 
    On occasion, there may be apps on the App Store that don't appear to be in compliance with the App Store Review Guidelines. We work hard to ensure that the apps on the App Store are in compliance and we try to identify any apps currently on the App Store that may not be. It takes time to identify these occurrences but another app being out of compliance is not a reason for your app to be.
    For discrete code-level questions, you may wish to consult with Apple Developer Technical Support. Please be sure to:
    - include the complete details of your rejection issues
    - prepare any symbolicated crash logs, screenshots, and steps to reproduce the issues for when the DTS engineer follows up.
    For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS Application Crash Reports.
    If you have difficulty reproducing this issue, please try testing the workflow as described in  <https://developer.apple.com/library/ios/qa/qa1764/>Testing Workflow with Xcode's Archive feature".

  • Apps that use non-public APIs will be rejected

    Hi guys
    Just reading the iOS guidelines before I get too deep into making the native version of a web app.
    I was wondering what:
    Apps that use non-public APIs will be rejected
    means when submitting an app made in AIR - does it mean you can't use your own custom classes?
    Cheers

    If you mean custom AS3 classes, yes you can use those. What you can't do is create an ANE that calls into the private frameworks of iOS itself.

  • Public API for contract group change

    Hi,
    Does anyone know of a public API to change contract grouping? The only one I found is a private API: OKC_CGC_PVT.update_row.
    TIA,
    Alka.

    Thanks Nagamohan. I did look at the package, but did not notice "update_contract_grpngs" procedure in it.....need to pay more attention :-)

  • Creating Job material using public API from WIP

    Take the entered component part number and search in the WIP job material requirements. This should use a WIP API. If the material is found, increment the quantity. If material is not found, create the job material using public API. (Provide WIP API details)
    The java object, oracle.apps.csd.schema.server .CsdHvWipJobPvtEO is a wrapper to call WIP API. This should be used to create material requirements is this the procedure to create job material Req.
    from OAF how we have to create Job material transaction

    Hi Pat,
    What is your SBO version? I've seen several cases in which the login/connection procedure (both in the client and via DI API) has become much slower after upgrading to SBO 2005.
    Do you experience the same slowness when connecting via DI API in a non-WebService setting?
    I would not recommend using DI API in a web service context in the first place. DI Server would give you a much more robust, stable and scalable infrastructure to build upon.
    Henry

  • Public API/Interface name to import the payment information against invoice

    Hi,
    I want to get the Oracle supported Public API/Interface name to import the payment information against invoices(because there is a need to importing payment data against closed invoices from 11.5.5 to R12). Since I am not getting any standard oracle supported method, I am using the API AP_PAY_INVOICE_PKG.AP_PAY_INVOICE but while running it I am getting the following error:-
    Payment API Error =ORA-20001: APP-SQLAP-10000: ORA-28115: policy with check option violation
    occurred in
    AP_AIP_TABLE_HANDLER_PKG.Insert_Row <-AP_PAY_INVOICE_PKG.ap_pay_insert_invoice_payments<-AP_PAY_INVOICE_PKG.ap_pay_invoice<-.
    Regards,

    The below query will meet your requirement, but payment amount won't matches with some cases see below .
    1) Check Payment/EFT Payment for more than one invoice we will pay that time invoice amount is
    not equal to payment amount, Payment amount is greater than Invoice Amount.  This will be controlled in Report level.
    if you develop report using this query, there you can control this issue.
    SELECT aia.vendor_id, aps.vendor_name, aia.invoice_id, aia.invoice_num,
           aia.invoice_date, aia.invoice_currency_code, aia.payment_currency_code,
           aia.invoice_amount, aia.amount_paid, aia.payment_method_lookup_code,
           aia.payment_method_code, aia.SOURCE, aia.invoice_type_lookup_code,
           aia.voucher_num, aca.amount payment, aca.bank_account_name,
           aca.check_id, aca.check_number, aca.currency_code,
           aca.payment_method_lookup_code, aipa.accrual_posted_flag,
           aipa.cash_posted_flag, aipa.posted_flag
      FROM ap_invoices_all aia,
           ap_checks_all aca,
           ap_invoice_payments_all aipa,
           ap_suppliers aps
    WHERE aia.invoice_id = aipa.invoice_id
       AND aca.check_id = aipa.check_id
       AND aia.vendor_id = aps.vendor_id
    if it's meet your requirement pls check the Correct/Helpful Answer for your question.
    you can modify this query here and there as per your required fields.
    Thanks
    Hari

  • [svn:osmf:] 14180: PARB changes: Move BinarySearch to layout package, it doesn't need to be part of the public API.

    Revision: 14180
    Revision: 14180
    Author:   [email protected]
    Date:     2010-02-15 21:52:51 -0800 (Mon, 15 Feb 2010)
    Log Message:
    PARB changes: Move BinarySearch to layout package, it doesn't need to be part of the public API.
    Modified Paths:
        osmf/trunk/framework/OSMF/.flexLibProperties
        osmf/trunk/framework/OSMF/org/osmf/layout/LayoutRendererBase.as
    Added Paths:
        osmf/trunk/framework/OSMF/org/osmf/layout/BinarySearch.as
        osmf/trunk/framework/OSMFTest/org/osmf/layout/TestBinarySearch.as
    Removed Paths:
        osmf/trunk/framework/OSMF/org/osmf/utils/BinarySearch.as
        osmf/trunk/framework/OSMFTest/org/osmf/utils/TestBinarySearch.as

    Revision: 14180
    Revision: 14180
    Author:   [email protected]
    Date:     2010-02-15 21:52:51 -0800 (Mon, 15 Feb 2010)
    Log Message:
    PARB changes: Move BinarySearch to layout package, it doesn't need to be part of the public API.
    Modified Paths:
        osmf/trunk/framework/OSMF/.flexLibProperties
        osmf/trunk/framework/OSMF/org/osmf/layout/LayoutRendererBase.as
    Added Paths:
        osmf/trunk/framework/OSMF/org/osmf/layout/BinarySearch.as
        osmf/trunk/framework/OSMFTest/org/osmf/layout/TestBinarySearch.as
    Removed Paths:
        osmf/trunk/framework/OSMF/org/osmf/utils/BinarySearch.as
        osmf/trunk/framework/OSMFTest/org/osmf/utils/TestBinarySearch.as

  • [svn:osmf:] 14181: PARB changes: Move DateUtil to f4mClasses, it doesn' t need to be part of the public API.

    Revision: 14181
    Revision: 14181
    Author:   [email protected]
    Date:     2010-02-15 21:57:55 -0800 (Mon, 15 Feb 2010)
    Log Message:
    PARB changes: Move DateUtil to f4mClasses, it doesn't need to be part of the public API.
    Modified Paths:
        osmf/trunk/framework/OSMF/.flexLibProperties
        osmf/trunk/framework/OSMF/org/osmf/elements/f4mClasses/ManifestParser.as
    Added Paths:
        osmf/trunk/framework/OSMF/org/osmf/elements/f4mClasses/DateUtil.as
    Removed Paths:
        osmf/trunk/framework/OSMF/org/osmf/utils/DateUtil.as

    Revision: 14181
    Revision: 14181
    Author:   [email protected]
    Date:     2010-02-15 21:57:55 -0800 (Mon, 15 Feb 2010)
    Log Message:
    PARB changes: Move DateUtil to f4mClasses, it doesn't need to be part of the public API.
    Modified Paths:
        osmf/trunk/framework/OSMF/.flexLibProperties
        osmf/trunk/framework/OSMF/org/osmf/elements/f4mClasses/ManifestParser.as
    Added Paths:
        osmf/trunk/framework/OSMF/org/osmf/elements/f4mClasses/DateUtil.as
    Removed Paths:
        osmf/trunk/framework/OSMF/org/osmf/utils/DateUtil.as

  • [svn:osmf:] 14187: PARB changes: Make TimeUtil non-public, it doesn' t need to be part of the public API.

    Revision: 14187
    Revision: 14187
    Author:   [email protected]
    Date:     2010-02-16 09:37:39 -0800 (Tue, 16 Feb 2010)
    Log Message:
    PARB changes: Make TimeUtil non-public, it doesn't need to be part of the public API.
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/utils/ExternalProperty.as
        osmf/trunk/framework/OSMF/org/osmf/utils/TimeUtil.as

    Revision: 14187
    Revision: 14187
    Author:   [email protected]
    Date:     2010-02-16 09:37:39 -0800 (Tue, 16 Feb 2010)
    Log Message:
    PARB changes: Make TimeUtil non-public, it doesn't need to be part of the public API.
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/utils/ExternalProperty.as
        osmf/trunk/framework/OSMF/org/osmf/utils/TimeUtil.as

  • How to get the private and public key?

    there is my code,i want to get the public key and the private key �Cbut i could not find the the approprite method to solve the problem.
    import java.security.Key;
    import javax.crypto.Cipher;
    import java.security.KeyPairGenerator;
    import java.security.KeyPair;
    import java.security.Security;
    public class PublicExample {
    public static void main(String[] args) throws Exception {
    if (args.length != 1) {
    System.err.println("Usage:java PublicExample <text>");
    System.exit(1);
    byte[] plainText = args[0].getBytes("UTF8");
    System.out.println("\nStart generating RSA key");
    KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
    keyGen.initialize(512);
    KeyPair key = keyGen.generateKeyPair();
    System.out.println("Finish generating RSA key");
    Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC");
    //System.out.println("\n" + cipher.getProvider().getInfo());
    System.out.println("\nStart encryption");
    cipher.init(Cipher.ENCRYPT_MODE, key.getPublic());
    byte[] cipherText = cipher.doFinal(plainText);
    System.out.println("Finish encryption:");
    System.out.println(new String(cipherText, "UTF8"));
    System.out.println("\nStart decryption");
    cipher.init(Cipher.DECRYPT_MODE, key.getPrivate());
    /*i want to get the private and public key in this method ,but i found the result was not
    the one i expected to get,how to solve the problem?
    thanks in advance!
    System.out.println("private key:" + key.getPrivate().toString());
    System.out.println("public key:" + key.getPublic().toString());
    byte[] newPlainText = cipher.doFinal(cipherText);
    System.out.println("Finish decryption:");
    System.out.println(new String(newPlainText, "UTF8"));
    thanks in advance!

    System.out.println("private key:" +
    " + key.getPrivate().toString());
    System.out.println("public key:" +
    + key.getPublic().toString());
    key.getPrivate() returns an instance of PrivateKey and key.getPublic() returns an instance of PublicKey. Since PublicKey and PrivateKey are interfaces then they will return one of the concrete implementations. Check out the Javadoc for PublicKey and PrivateKey.
    When you know which concreate implemenation you have then you can use the methods on that object (by appropriate casting) to find the information you want.

  • AP Supplier Products & Services Public API

    Hi,
    As part of R12 Vendor data migration we need to migrate info in AP Supplier screen "Products & Services" tab. Products & Services are already defined in the system. Need to pick at vendor level, Add it and Approve it. Is there is any Oracle standard Public API is available to do the same. Please advice.
    Thanks,
    Vinoth.K

    Hi ,
    Is it possible to get example code you have used to integrate API. I am trying to do it using C# but I am unable to get the catalogue list or product list .
    Any help will be highly appreciated .
    Thanks

  • Public API's to create delivery for each delivery line

    I've requirement to create unique delivery for each delivery line using API. Can any body use public API to meet this requirement. Please ! any idea and thought !
    R12.
    Thanks in Advance,
    Ramana

    Try the WSH_DELIVERIES_PUB.Create_Update_Delivery API. The API creates a new delivery record or updates an existing delivery record in WSH_NEW_DELIVERIES table. The DELIVERY_ID, NAME and return status of a new delivery are passed as OUT parameters, while the DELIVERY_ID or NAME of an existing delivery for update is passed as an IN parameter.
    Pass IN parameter p_action_code value UPDATE ---> incase you want to update existing delivery.
    Pass IN parameter p_action_code value CREATE --> incase you want to create a new dleivery.
    Parameter Usage Type Required
    p_api_version_number IN Number x
    p_init_msg_list IN Varchar2 -
    x_return_status OUT Varchar2 -
    x_msg_count OUT Number -
    x_msg_data OUT Varchar2 -
    p_action_code IN Varchar2 x
    p_delivery_info IN OUT Record x
    p_delivery_name IN Varchar2 -
    x_delivery_id OUT Number -
    x_name OUT Varchar2 -
    I hope all this infor. comes handy.
    -Dhawang

Maybe you are looking for

  • ORA-01722 when executing a procedure

    I am executing a procedure in a package thru a nightly database job. This job has been working fine for the last several months. However recently it started abending with a ORA-01722 error. No changes have been made to the code. The procedure code fo

  • OnOne Phototools 2.6. Can it be made to work in Adobe CC?

    I have been using OnOne Phototools 2.6 in Photoshop 5. I have just "upgraded" to CC and have found that PhotoTools 2.6 is not supported. It's not a current products and is no longer being devloped by OnOne. Does anyone know of a work around that will

  • EVENT_KEYPRESS in Linux not consistant

    Hello all, things don't happen as expected in a keypress event in a panel callback: printf("\n0x%08x - %s%s%s '%c' - Remains 0x%08x", eventData1, eventData1&VAL_SHIFT_MODIFIER?" Shift":"", eventData1&VAL_UNDERLINE_MODIFIER?" Alt":"", eventData1&VAL_M

  • Invalid transaction state when using CMR

    I've code a method which involves CMR in CMP. It's a many to many relationship. Initially I was using JBoss 4 which supports EJB 2.1. Now, I'm migrating to OC4J Standalone 10.1.2 which supports only EJB 2.0. I get the error below whenever I call the

  • Turning off BIA for an individual query

    Hi,   Can anybody where I can go to turn off BIA for a specific query? Thanks