uiimagepickercontroller - get the name of the image selected from photo library

前端 未结 2 751
星月不相逢
星月不相逢 2021-02-03 14:25

I am trying to upload the image from my iPhone/iPod touch to my online repository, I have successfully picked the image from Photo Album but i am facing one problem i want to kn

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-03 15:00

    I guess knowing the exact image name would not be an issue rather getting a unique name for the picked image would solve your purpose so that you can upload the image on server and track it via its name. May be this can help you

    NSMutableString *imageName = [[[NSMutableString alloc] initWithCapacity:0] autorelease];
    
    CFUUIDRef theUUID = CFUUIDCreate(kCFAllocatorDefault);
    if (theUUID) {
        [imageName appendString:NSMakeCollectable(CFUUIDCreateString(kCFAllocatorDefault, theUUID))];
                CFRelease(theUUID);
    }
    [imageName appendString:@".png"];
    

    After you pick the image from Picker you can generate a unique name and assign it to the Picked image. Cheers

提交回复
热议问题