Skip to content

addRoute… is annotated have block parameters NSDictionary<String *, String *> but isn't #76

@zacwest

Description

@zacwest

The addRoute method is declared like:

+ (void)addRoute:(NSString *)routePattern handler:(BOOL (^__nullable)(NSDictionary<NSString *, NSString *> *parameters))handlerBlock;

However, the parameters it passes include:

  • kJLRouteNamespaceKey which can be [NSNull null]
  • kJLRouteURLKey which is an NSURL

These cause a crash when trying to convert into a [String: String] (in Swift) that looks like…

* thread #1: tid = 0xbbf578, 0x000000010cb4855f libswiftCore.dylib`swift_bridgeNonVerbatimFromObjectiveC + 255, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
    frame #0: 0x000000010cb4855f libswiftCore.dylib`swift_bridgeNonVerbatimFromObjectiveC + 255
    frame #1: 0x000000010cb43f70 libswiftCore.dylib`deallocateBuffer value witness for Swift.LazyMapCollection + 16
    frame #2: 0x000000010ce63da1 libswiftFoundation.dylib`Swift._forceBridgeFromObjectiveC <A> (Swift.AnyObject, A.Type) -> A + 385
    frame #3: 0x000000010ce63b80 libswiftFoundation.dylib`static (extension in Foundation):Swift.Dictionary.(_forceBridgeFromObjectiveC (__ObjC.NSDictionary, result : inout Swift.Optional<Swift.Dictionary<A, B>>) -> ()).(closure #1) + 144
    frame #4: 0x000000010ce60624 libswiftFoundation.dylib`partial apply forwarder for static (extension in Foundation):Swift.Dictionary.(_forceBridgeFromObjectiveC (__ObjC.NSDictionary, result : inout Swift.Optional<Swift.Dictionary<A, B>>) -> ()).(closure #1) + 100
    frame #5: 0x000000010bd681e6 CoreFoundation`__65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102
    frame #6: 0x000000010bd680af CoreFoundation`-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 159
    frame #7: 0x000000010ce4fb4e libswiftFoundation.dylib`static (extension in Foundation):Swift.Dictionary._forceBridgeFromObjectiveC (__ObjC.NSDictionary, result : inout Swift.Optional<Swift.Dictionary<A, B>>) -> () + 558
    frame #8: 0x000000010ce4f87b libswiftFoundation.dylib`Foundation._convertNSDictionaryToDictionary <A, B where A: Swift.Hashable> (Swift.Optional<__ObjC.NSDictionary>) -> Swift.Dictionary<A, B> + 75
    frame #9: 0x00000001046ba40d Imgur`thunk + 77 at Routing.swift:0
  * frame #10: 0x0000000108461954 JLRoutes`+[JLRoutes routeURL:withController:parameters:executeBlock:](self=JLRoutes, _cmd="routeURL:withController:parameters:executeBlock:", URL="aaaaaa -- mgur://imgur.com", routesController=0x00007f8b14d20ae0, parameters=0x0000000000000000, executeBlock=YES) + 2740 at JLRoutes.m:551

The key is definitely an NSString but the values are not.

Activity

julien1619

julien1619 commented on Aug 4, 2016

@julien1619

I confirm the crash since the last update to 1.6.1. This commit causes the crash : 910e485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @zacwest@julien1619

      Issue actions

        `addRoute…` is annotated have block parameters NSDictionary<String *, String *> but isn't · Issue #76 · joeldev/JLRoutes