OVH Cloud OVH Cloud

[ObjC] pb d'argument

1 réponse
Avatar
pere.noel
j'essaie tjs de résoudre un Alias file par ObjC.

je suis l'article d'Apple "Resolving Aliases" :
<http://developer.apple.com/documentation/Cocoa/Conceptual/LowLevelFileM
gmt/Tasks/ResolvingAliases.html>

et quasiment la 1ière ligne ne marche pas :

url = CFURLCreateWithFileSystemPath(NULL /*allocator*/,
(CFStringRef)path,
kCFURLPOSIXPathStyle, NO /*isDirectory*/);

c'est le "(CFStringRef)path" qui "ne passe pas"...

dans mon *.h j'ai mis ça :
#import <Foundation/Foundation.h>
#import <CoreServices/CoreServices.h>

@interface BDAlias : NSObject
{
NSString *_fullAliasPath;
}

- (id)initWithAliasPath:(NSString *)fullAliasPath;
- (void)dealloc;
- (NSString *)resolveAliasFile;

@end


et dans le *.m :

#import "BDAlias.h"

@implementation BDAlias

- (id)initWithAliasPath:(NSString *)fullAliasPath
{
id ret = [super init];
if (ret != nil) {
_fullAliasPath = fullAliasPath;
}
return ret;
}


donc _fullAliasPath est une (NSString *)

dans le listing Apple, cette NSString est castée en CFStringRef,
apparemment, c'est ce qui bloque à l'éxécution...


pourquoi ?

ps la ligne quivalente Apple :

url = CFURLCreateWithFileSystemPath(NULL /*allocator*/,
(CFStringRef)path,
kCFURLPOSIXPathStyle, NO /*isDirectory*/);




--
une bévue

1 réponse

Avatar
pere.noel
Une bévue wrote:

le pb était du côté ruby il faut passer une NSString et non pas une
string ruby...

--
une bévue