Dieser Fehler tritt auf, wenn Sie mit Zielen in Ihrem Projekt spielen. Der NSFileTypeForHFSTypeCode wird nur benötigt, wenn Sie das Projekt gegen das Mac OS-Ziel kompilieren, und sollte nicht verwendet werden, wenn das Ziel ein iPhone ist. Tatsächlich scheint der Fehler bei den neuen Versionen von XCode zu passieren, selbst wenn Ihr Projekt als iPhone ausgerichtet ist. Alte Antwort:
So schreiben wir müssen Implementierung applicationIDString und bedingte Flaggen setzen:
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
- (NSString*)applicationIDString {
NSString *s = NSFileTypeForHFSTypeCode([self applicationID]);
assert([s length] == 6);
s = [s substringWithRange:NSMakeRange(1, 4)];
return s;
}
#endif
Die Bedingung, wenn TARGET_OS_MAC wird die Notwendigkeit von TARGET_OS_IPHONE nicht ersetzen, weil TARGET_OS_IPHONE eigentlich eine Variante des TARGET_OS_MAC ist. So zu vermeiden Fehler kompilieren, fügen #if TARGET_OS_MAC & & TARGET_OS_IPHONE
Auch unter diesem Teil des Codes:
- (void)setApplicationIDString:(NSString*)s {
if ([s length] != 4) {
NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]);
}
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
[self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"'%@'", s])];
#endif
}
Neue Antwort:
ich den Code und neu geordnet Methoden aktualisiert in FMDatabaseAdditions.m mehr dem Bereich (Bedingungen) zugeordnet sein.:
#if SQLITE_VERSION_NUMBER >= 3007017
- (uint32_t)applicationID {
uint32_t r = 0;
FMResultSet *rs = [self executeQuery:@"pragma application_id"];
if ([rs next]) {
r = (uint32_t)[rs longLongIntForColumnIndex:0];
}
[rs close];
return r;
}
- (void)setApplicationID:(uint32_t)appID {
NSString *query = [NSString stringWithFormat:@"pragma application_id=%d", appID];
FMResultSet *rs = [self executeQuery:query];
[rs next];
[rs close];
}
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
- (NSString*)applicationIDString {
NSString *s = NSFileTypeForHFSTypeCode([self applicationID]);
assert([s length] == 6);
s = [s substringWithRange:NSMakeRange(1, 4)];
return s;
}
- (void)setApplicationIDString:(NSString*)s {
if ([s length] != 4) {
NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]);
}
[self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"'%@'", s])];
}
#endif
#endif
auch andere Warnungen zu vermeiden ich FMDatabaseAdditions.h
#if SQLITE_VERSION_NUMBER >= 3007017
///-----------------------------------
/// @name Application identifier tasks
///-----------------------------------
/** Retrieve application ID
@return The `uint32_t` numeric value of the application ID.
@see setApplicationID:
*/
- (uint32_t)applicationID;
/** Set the application ID
@param appID The `uint32_t` numeric value of the application ID.
@see applicationID
*/
- (void)setApplicationID:(uint32_t)appID;
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
/** Retrieve application ID string
@return The `NSString` value of the application ID.
@see setApplicationIDString:
*/
- (NSString*)applicationIDString;
/** Set the application ID string
@param string The `NSString` value of the application ID.
@see applicationIDString
*/
- (void)setApplicationIDString:(NSString*)string;
#endif
#endif
Hey, @LibanAbdulle, überprüfen Sie die Antwort unten als Lösung geändert! Weil diese Antwort mein Problem löst! –