سؤال

لفتح خرائط Google بالاتجاهات، فأنا أستخدم NSstring منسق داخل NSURL. لكنه لا يعمل مع [[UIAPPlication SharedApplication] OpenURL: NSURL]؛

الشفرة:

NSString * directionsURL = [NSString stringWithFormat:@"http://maps.google.com/maps?daddr=%@&saddr=%@", @"Hartenseweg 16, Renkum", @"1 Infinte Loop, Cupertino"];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:directionsURL]];
هل كانت مفيدة؟

المحلول

تحتاج إلى استخدام [NSString stringByReplacingPercentEscapesUsingEncoding:] لضمان الحصول على سلسلة مشفرة بشكل صحيح لعنوان URL.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top