想知道有無論如何我們可以修復將空格字符串轉換爲地幔中的NSURL的失敗?帶空格的字符串未能轉換爲NSURL - 地幔
我得到以下地幔錯誤:
錯誤域= MTLTransformerErrorHandlingErrorDomain代碼= 1 「無法轉換字符串URL」 的UserInfo = {0x7ff9e8de4090 = MTLTransformerErrorHandlingInputValueErrorKey YY https://x.com/dev-pub-image-md/x-img/02020-x [email protected],NSLocalizedDescription =無法轉換字符串到URL,NSLocalizedFailureReason =輸入URL字符串https://x.com/dev-pub-image-md/x-img/02020-x yy [email protected]格式錯誤}
下面的類文件;
.H -
#import "Mantle.h"
@interface Place : MTLModel <MTLJSONSerializing>
@property (strong, nonatomic) NSString *placeId;
@property (strong, nonatomic) NSURL *logoURL;
@end
.M -
#import "Place.h"
@implementation Place
+ (NSDictionary *)JSONKeyPathsByPropertyKey {
return @{@"placeId": @"placeId",
@"logoURL":@"circleImage"
};
}
+ (NSValueTransformer *)logoURLJSONTransformer {
return [NSValueTransformer valueTransformerForName:MTLURLValueTransformerName];
}
@end
提前感謝!